ruby and microsoft sql server

P

PaÅ­lo Geyer

hi, anyone here has experience with microsoft sql server?
i did this little program:

#!/usr/bin/env ruby

require 'dbi'
conn = DBI.connect('DBI:ODBC:jornaldedebates', 'sa', 'fodase')
puts conn.tables

but when i try to run it, i get this error:
paulo@shuffle:~/Desktop/tmp/sql$ ./dbi.rb
/usr/lib/ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect': IM003 (0) [iODBC]
[Driver Manager]Specified driver could not be loaded
(DBI::DatabaseError)
from /usr/lib/ruby/1.8/dbi.rb:424:in `connect'
from /usr/lib/ruby/1.8/dbi.rb:215:in `connect'
from ./dbi.rb:4


any ideas?
 
H

Huw Collingbourne

Paulo Geyer said:
hi, anyone here has experience with microsoft sql server?

Are you using ADO.rb?

I wrote a tutorial on using SQL Server for Rails development with Ruby In
Steel here:

http://www.sapphiresteel.com/Using-SQL-Server-With-A-Rails

Naturally, the tutorial includes much that is specific to Ruby In Steel.
However, it may also give you some help on using SQL Server and Ruby in
general.

best wishes
Huw Collingbourne

http://www.sapphiresteel.com
Ruby Programming In Visual Studio 2005
 
S

Stefan Schmiedl

hi, anyone here has experience with microsoft sql server? i did this
little program:

#!/usr/bin/env ruby

require 'dbi'
conn = DBI.connect('DBI:ODBC:jornaldedebates', 'sa', 'fodase') puts
conn.tables

but when i try to run it, i get this error:
paulo@shuffle:~/Desktop/tmp/sql$ ./dbi.rb
/usr/lib/ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect': IM003 (0) [iODBC]
[Driver Manager]Specified driver could not be loaded
(DBI::DatabaseError)
from /usr/lib/ruby/1.8/dbi.rb:424:in `connect' from
/usr/lib/ruby/1.8/dbi.rb:215:in `connect' from ./dbi.rb:4


any ideas?

verify that your linux (presumably) based ODBC setup is working correctly.
Since you're connecting to MSSQL you'll probably have an installation of
FreeTDS lying around, which needs to be correctly configured, too.

There are console tools for both components which can be used to put the
finger on the failing link in the chain.

ruby - dbi - odbc -- unixODBC - freetds -- network -- mssql

The error message tells me that you're reaching odbc from the left,
I also assume that you can actually connect via TCP/IP with the given
authentication data to MSSQL and that you can ping the Windows box.
But there are still two possible points of failure left.

HTH
s.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top