Accessing SQL Azure from an Azure Worker Role?
-
2010年2月14日 11:52
I need to access a SQL Azure databse from a worker role. It seems I have 3 choices:
ODBC
System.Data.SqlClient
PHP
My worker role is running a ruby on rails app - with the SQL Server adapter. It works fine on the development fabric using OLEDB, but this is not an option for deploying to the cloud.
Neither can I use php.
Is there any way I can either:
specify System.Data.SQLClient as the provider on the connection string?
or
set up an ODBC data source as part of the initialisation of the worker role and use that?
Thanks- 已移动 Brian AurichMicrosoft Employee, Moderator 2010年9月28日 22:12 migration (From:SQL Azure)
全部回复
-
2010年2月14日 16:09Why not a web role, if I may ask?
mysorian -
2010年2月15日 1:22版主Hello, currently OLEDB is not supported. I don't know Ruby, but a search for Ruby ODBC on the internet returns a lot of results. Can you try to use an ODBC solution for Ruby? Please also make sure you have configured SQL Azure's firewall rule to "Allow Microsoft Services access to this server".
Lante, shanaolanxing This posting is provided "AS IS" with no warranties, and confers no rights. -
2010年2月15日 9:01Yes. The normal (only) way to access SQL Server from ruby on linux is via ODBC.
I am happy to try this - but how should I set up the ODBC data source? I know this can be done programatically during one of the start up events in the worker role, but is there an easier way to do this - by configuration or something? Has anyone got any advice? -
2010年2月15日 11:37
Why not a web role, if I may ask?
mysorian
Hi. I am using Ruby. This would mean I need an IIS fast-cgi component for ruby and as far as I know that's a little problematic? Do you know differently? -
2010年2月15日 13:45
Ignore me. it works out of the box. Need to set database.yaml as follows:
development:
adapter: sqlserver
mode: ODBC
dsn: Driver={SQL Server};Server=<server>.database.windows.net;Database=<database_name>;Uid=user@server>;Pwd=<whatever>;
- 已标记为答案 nikkh 2010年2月15日 13:45

