SQL Server Trouble with Rails

Posted by Earlz on Stack Overflow See other posts from Stack Overflow or by Earlz
Published on 2010-04-06T22:57:32Z Indexed on 2010/04/06 23:03 UTC
Read the original article Hit count: 470

Filed under:
|
|
|

Ok, I've been trying to get this to work like all day now and I'm barely any further from when I started.

I'm trying to get Ruby On Rails to connect to SQL Server. I've installed unixODBC and configured it and FreeTDS and installed just about every Ruby gem relating to ODBC that exists.

[earlz@earlzarch myproject]$ tsql -S AVP1 -U sa -P pass
locale is "en_US.UTF-8"
locale charset is "UTF-8"
1> quit
[earlz@earlzarch myproject]$ isql AVP1 sa pass
[ISQL]ERROR: Could not SQLConnect
[earlz@earlzarch myproject]$ rake db:version
(in /home/earlz/myproject)
rake aborted!
IM002 (0) [unixODBC][Driver Manager]Data source name not found, and no default driver specified

(See full trace by running task with --trace)

so, as you can see, tsql works, but not isql. What is the difference in the two that breaks it?

/etc/odbc.ini

[AVP1]
      Description     = ODBC connection via FreeTDS
      Driver = TDS
      Servername      = my.server
      UID = sa
      PWD = pass
      port = 1232
      Database        = mydatabase

/etc/odbcinst.ini

[TDS]
     Description     = v0.6 with protocol v7.0
     Driver          = /usr/lib/libtdsodbc.so
     Setup           = /usr/lib/libtdsS.so
     CPTimeout       =
     CPReuse         =
     FileUsage       = 1

(and yes, I've made sure that the .so files exist)

the relevant part in freetds.conf

[AVP1]
      host = my.server
      port = 1232
      tds version = 8.0

and finally, my database.yml

development:
    adapter: sqlserver
    mode: odbc
    dsn: AVP1
    username: sa
    password: pass

Can anyone please help me before I pull all my hair out?

I am using a 64 bit Arch Linux that is completely up to date.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about odbc