Hello,

I decided to embrace getting a new Rails application to see an
existing MSSQL database and trying to get unixODBC, freeTDS, and
ActiveRecord able to query my MSSQL database.

I'm following the procedure outlined at
http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServerFromRailsOnLinux
but my system (Ubuntu 8.10 - Intrepid Ibex, Rails 2.3, Ruby 1.8.7)
isn't cooperating.

I get as far as able to use 'sqsh' to test the server-side connection
and able to run SQL, but 'isql' or the IRB aren't able to access my
unixODBC DSN.

My /etc/odbc.ini:
[Server1]
Driver          = FreeTDS
Description             = SQLServer Database
Trace           = No
Server          = ip_of_server
Port            = 1433
Database                = DB_Name

My /etc/odbcinst.ini:
[FreeTDS]
Description             = TDS driver (Sybase/MS SQL)
Driver          = /usr/lib/odbc/libtdsodbc.so
Setup           = /usr/lib/odbc/libtdsS.so
CPTimeout               =
CPReuse         =
UsageCount              = 2

My /usr/lib/odbc directory:
total 680
-rw-r--r-- 1 root root   9516 2008-09-01 03:14 libesoobS.so
-rw-r--r-- 1 root root   5360 2008-09-01 03:14 libmimerS.so
-rw-r--r-- 1 root root  67604 2008-09-01 03:14 libnn.so
-rw-r--r-- 1 root root   5336 2008-09-01 03:14 libodbcdrvcfg1S.so
-rw-r--r-- 1 root root   5328 2008-09-01 03:14 libodbcdrvcfg2S.so
-rw-r--r-- 1 root root   5388 2008-09-01 03:14 libodbcminiS.so
-rw-r--r-- 1 root root   9440 2008-09-01 03:14 libodbcmyS.so
-rw-r--r-- 1 root root   5332 2008-09-01 03:14 libodbcnnS.so
-rw-r--r-- 1 root root   5424 2008-09-01 03:14 libodbcpsqlS.so
-rw-r--r-- 1 root root 148972 2008-09-01 03:14 libodbctxt.so
-rw-r--r-- 1 root root   5352 2008-09-01 03:14 libodbctxtS.so
-rw-r--r-- 1 root root   9720 2008-09-01 03:14 liboplodbcS.so
-rw-r--r-- 1 root root   5332 2008-09-01 03:14 liboraodbcS.so
-rw-r--r-- 1 root root   5332 2008-09-01 03:14 libsapdbS.so
-rw-r--r-- 1 root root 341668 2008-08-01 18:28 libtdsodbc.so
-rw-r--r-- 1 root root   5320 2008-09-01 03:14 libtdsS.so

Output from IRB test:
irb(main):001:0> require "dbi"
=> true
irb(main):002:0> dbh = DBI.connect('dbi:ODBC:ivyweblv', 'railsuser',
'Pa$$w0rd')
DBI::DatabaseError: S1000 (0) [unixODBC][FreeTDS][SQL Server]Unable to
connect to data source
        from /usr/local/lib/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in
`connect'
        from /usr/local/lib/site_ruby/1.8/dbi/dbi.rb:584:in `connect'
        from /usr/local/lib/site_ruby/1.8/dbi/dbi.rb:384:in `connect'
        from (irb):2
        from :0

Output from isql test:
[ISQL]ERROR: Could not SQLConnect

I followed the troubleshooting section in the above RubyOnRails Wiki
page, but am not able to get unixODBC to see the freeTDS driver it
seems.

Thanks in advance,
Andy Pflueger
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to