ODBC connection string for MS-Access

I have tried the following strings for connecting to MS-Access using
Ruby/ODBC and Ruby/dbi. None of them work.

Attempt# 1>

cnstr = “Provider=Microsoft.Jet.OLEDB.4.0;”
“DATA SOURCE=C:\mytest.mdb;” +
“USER ID=admin;PASSWORD=;”

Attempt# 2>

connect_str = “Driver={Microsoft Access Driver (*.mdb)};” +
“Dbq=C:\mytest.mdb;” + “Uid=admin;” + “Pwd=”

Attempt# 3> This one worked with Win32OLE but not with ODBC :frowning:

$db.ConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0;” +
“Data Source=“C:\mytest.mdb””

Any suggestions?
TIA,
– shanko

“Shashank Date” sdate@everestkc.net wrote in message

I have tried the following strings for connecting to MS-Access using
Ruby/ODBC and Ruby/dbi. None of them work.

Forgot to mention that I am on Win XP(Home) using the latest
ruby-1.8.1 (one-click installer) and MS_Access 2002 (SP-1).

– shanko

Hi,

···

— Shashank Date sdate@everestkc.net wrote:

I have tried the following strings for connecting to
MS-Access using
Ruby/ODBC and Ruby/dbi. None of them work.

Check this out:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/67352

I’ve tested it successfully.

Cheers,
Joao


Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.

Hi Joao,

Check this out:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/67352

I’ve tested it successfully.

I tried method 2 (DSN less) described in that post as
follows:

···

— Joao Pedrosa joaopedrosa@yahoo.com wrote:
#-------------------
require ‘dbi’

using the DSN-less connection

db=DBI.connect(‘DBI:ODBC:driver=Microsoft Access
Driver (*.mdb);dbq=C:/mrmat4.mdb’)
#-------------------

And I got the following error:
C:/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:78:in
connect': S1090 (0) [Microsoft][ODBC Driver Manager] Invalid string or buffer length (DBI::DatabaseError) from C:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:550:in connect’
from C:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:367:in
`connect’
from C:/atest/tst_odbc2.rb:4

The code for Method 1 had few typos and after
correcting those I still could not get it to work.
Would it possible for you to share your working
script?

Thanks for your time and attention.
– shanko


Do you Yahoo!?
Yahoo! Domains – Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer