[ruby-dbi-users] Error using dbd-odbc with SQL Server on OS X 10.5.5

doug livesey biot023 at gmail.com
Mon Dec 22 06:27:39 EST 2008


Further to that, I've been playing around, and cannot get it to connect. I'm
pretty sure that FreeTDS is OK, as the tsql connection works fine, and I can
connect & select databases & query them and everything.
So maybe my problem is with iODBC, but I don't know how to test this, so am
not sure.
For completeness (and recognising that this could well be a problem with
something other than ruby-dbi) I'll post my odbc config files -- if you
spotted something amiss there, that would be great, but I well understand
that this may be an odbc config problem, and so out of your purview.

<FILE /Library/ODBC/odbcinst.ini>
[ODBC Drivers]
TDS = Installed

[TDS]
Description = FreeTDS
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsodbc.so

</FILE>

<FILE /Library/ODBC/odbc.ini>
[ODBC Data Sources]
KYLIE = TDS

[holly_test]
Driver = TDS
Description = Description of this database connection
Trace = yes
TraceFile = /tmp/odbc.log
Servername = KYLIE
Database = holly_test

[holly_production]
Driver = TDS
Description = Description of this database connection
Trace = yes
TraceFile = /tmp/odbc.log
Servername = KYLIE
Database = holly_production

[holly_production_old]
Driver = /usr/local/lib/libtdsodbc.so
Description = Description of this database connection
Trace = yes
TraceFile = /tmp/odbc.log
Servername = KYLIE
Database = holly_production

</FILE>

My database.yml file contains this:
production:
  database: holly_production
  adapter: sqlserver
  mode: odbc
  dsn: KYLIE
  username: holly
  password: ********

(I've also tried the DSN-less configuration with no better result.)
And, finally, seeing as I've been changing things, here is a dump of the
latest error I get when trying to connect in the rails console:

DBI::DatabaseError: IM002 (0) [unixODBC][Driver Manager]Data source name not
found, and no default driver specified
from
/usr/local/lib/ruby/gems/1.8/gems/dbd-odbc-0.2.4/lib/dbd/odbc/driver.rb:36:in
`connect'
from
/usr/local/lib/ruby/gems/1.8/gems/dbi-0.4.1/lib/dbi/handles/driver.rb:33:in
`connect'
from /usr/local/lib/ruby/gems/1.8/gems/dbi-0.4.1/lib/dbi.rb:142:in `connect'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-1.0.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:46:in
`sqlserver_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`send'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in
`checkout_new_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`checkout'
from /usr/local/lib/ruby/1.8/monitor.rb:238:in `synchronize'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in
`retrieve_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:121:in
`retrieve_connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:113:in
`connection'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1214:in
`table_exists?'
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1353:in
`inspect'
from /usr/local/lib/ruby/1.8/irb.rb:298:in `output_value'
from /usr/local/lib/ruby/1.8/irb.rb:151:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:259:in `signal_status'
from /usr/local/lib/ruby/1.8/irb.rb:147:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:146:in `eval_input'
from /usr/local/lib/ruby/1.8/irb.rb:70:in `start'
from /usr/local/lib/ruby/1.8/irb.rb:69:in `catch'
from /usr/local/lib/ruby/1.8/irb.rb:69:in `start'
from /usr/local/bin/irb:13

Cheers for any help you can offer, and for all offered thus far, and it's
well understood if this falls outside of your remit.
   Doug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ruby-dbi-users/attachments/20081222/e123a35a/attachment.html>


More information about the ruby-dbi-users mailing list