I am trying to connect Rails to SQL Server. I installed activetecord-sqlserver-adapter and ruby-odbc gems, but I'm not sure what to add to my database.yml file.
What is DSN and why do I need it? (Is this some kind of feature for Windows?)
What if I want to use Windows authentication instead of specifying a username and password?
I tried to create a DSN by specifying Windows NT authentication and putting the following in my config.yml:
development:
adapter: sqlserver
dsn: myDsn
mode: odbc
but I get "The specified DSN contains an architecture mismatch error between the driver and the application." [I tried to create a DSN from Windows / system32 / odbcad32.exe since a google search said it would create a 32-bit DSN instead, but I get the same error.]
Am I missing something in my database.yml file?
UPDATE: I tried to use
development:
adapter: sqlserver
mode:odbc
dsn: Provider=SQLOLEDB; Data Source=.\SQLEXPRESS; Integrated Security=SSPI
but I get the message "Data source name not found and not specified by default." Is it possible that my provider is not SQLOLEDB? [I donβt know what the provider is or how to find out what it is - I just copied it from another connection string that I found.] I know that I can connect to. \ SQLEXPRESS using Windows authentication from my actual program SQL Server Management Studio.
source
share