ODBC connection string for MS-Access

That worked ... thanks a million Joao !!!

···

--- Joao Pedrosa <joaopedrosa@yahoo.com> wrote:

Hi,

The first time I tested it on IRB, but I recoded it
to
a minimum. Like this:

require 'odbc'
include ODBC

drv = Driver.new
drv.name = 'Driver1'
drv.attrs['driver'] = 'Microsoft Access Driver
(*.mdb)'
drv.attrs['dbq'] = 'c:/dbdemos'
dbh = Database.new.drvconnect(drv)
p dbh.tables.fetch_all

--- output:
C:\>ruby dsn.rb
[["c:/dbdemos", nil, "MSysAccessObjects", "SYSTEM
TABLE", nil], ["c:/dbdemos", n
il, "MSysACEs", "SYSTEM TABLE", nil], ["c:/dbdemos",
nil, "MSysObjects", "SYSTEM
TABLE", nil], ["c:/dbdemos", nil, "MSysQueries",
"SYSTEM TABLE", nil], ["c:/dbd
emos", nil, "MSysRelationships", "SYSTEM TABLE",
nil],
["c:/dbdemos", nil, "coun
try", "TABLE", nil], ["c:/dbdemos", nil, "customer",
"TABLE", nil], ["c:/dbdemos
", nil, "employee", "TABLE", nil], ["c:/dbdemos",
nil,
"items", "TABLE", nil], [
"c:/dbdemos", nil, "nextcust", "TABLE", nil],
["c:/dbdemos", nil, "nextitem", "T
ABLE", nil], ["c:/dbdemos", nil, "nextord", "TABLE",
nil], ["c:/dbdemos", nil, "
orders", "TABLE", nil], ["c:/dbdemos", nil, "parts",
"TABLE", nil], ["c:/dbdemos
", nil, "vendors", "TABLE", nil]]

Cheers,
Joao

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

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

That worked ... thanks a million Joao !!!

In the next minor version of Ruby/DBI, this will work:

  require 'dbi'
  dbh = DBI.connect("DBI:ODBC:driver=Microsoft Access Driver (*.mdb);dbq=c:/dbdemos")
  p dbh.tables

It's already fixed in CVS, I just need to make a release.

Regards,

  Michael

···

On Thu, May 20, 2004 at 11:38:24AM +0900, Shashank Date wrote:

--- Joao Pedrosa <joaopedrosa@yahoo.com> wrote:
>
> Hi,
>
> The first time I tested it on IRB, but I recoded it
> to
> a minimum. Like this:
>
> require 'odbc'
> include ODBC
>
> drv = Driver.new
> drv.name = 'Driver1'
> drv.attrs['driver'] = 'Microsoft Access Driver
> (*.mdb)'
> drv.attrs['dbq'] = 'c:/dbdemos'
> dbh = Database.new.drvconnect(drv)
> p dbh.tables.fetch_all
>
> --- output:
> C:\>ruby dsn.rb
> [["c:/dbdemos", nil, "MSysAccessObjects", "SYSTEM
> TABLE", nil], ["c:/dbdemos", n
> il, "MSysACEs", "SYSTEM TABLE", nil], ["c:/dbdemos",
> nil, "MSysObjects", "SYSTEM
> TABLE", nil], ["c:/dbdemos", nil, "MSysQueries",
> "SYSTEM TABLE", nil], ["c:/dbd
> emos", nil, "MSysRelationships", "SYSTEM TABLE",
> nil],
> ["c:/dbdemos", nil, "coun
> try", "TABLE", nil], ["c:/dbdemos", nil, "customer",
> "TABLE", nil], ["c:/dbdemos
> ", nil, "employee", "TABLE", nil], ["c:/dbdemos",
> nil,
> "items", "TABLE", nil], [
> "c:/dbdemos", nil, "nextcust", "TABLE", nil],
> ["c:/dbdemos", nil, "nextitem", "T
> ABLE", nil], ["c:/dbdemos", nil, "nextord", "TABLE",
> nil], ["c:/dbdemos", nil, "
> orders", "TABLE", nil], ["c:/dbdemos", nil, "parts",
> "TABLE", nil], ["c:/dbdemos
> ", nil, "vendors", "TABLE", nil]]
>
>
> Cheers,
> Joao
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains ? Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer

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

Hello Michael,

“Michael Neumann” mneumann@ntecs.de wrote in message

It’s already fixed in CVS, I just need to make a release.

Regards,

Michael

It is still not working for me:

···

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:>cd atest

C:\atest>ruby -v tst_dbi_odbc.rb
ruby 1.8.1 (2003-12-25) [i386-mswin32]
“0.0.18”
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 tst_dbi_odbc.rb:5

** After installing the newly released version:

C:\atest>ruby -v tst_dbi_odbc.rb
ruby 1.8.1 (2003-12-25) [i386-mswin32]
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:318: warning: method redefined;
discarding old fraction
“0.0.21”
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:575:in connect’
from c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:375:in `connect’
from tst_dbi_odbc.rb:5

C:\atest>type tst_dbi_odbc.rb
require ‘dbi’

p DBI::VERSION

dbh = DBI.connect(“DBI:ODBC:driver=Microsoft Access Driver
(*.mdb);dbq=C:/mrmat4”)
p dbh.tables

dbh.disconnect

C:\atest>ruby -v tst_odbc3.rb
ruby 1.8.1 (2003-12-25) [i386-mswin32]
[“C:/mrmat4”, nil, “MSysAccessObjects”, “SYSTEM TABLE”, nil]

C:\atest>type tst_odbc3.rb
require ‘odbc’
include ODBC

drv = Driver.new
drv.name = ‘Driver1’
drv.attrs[‘driver’] = ‘Microsoft Access Driver (*.mdb)’
drv.attrs[‘dbq’] = ‘C:/mrmat4’
dbh = Database.new.drvconnect(drv)
p dbh.tables.fetch_all[0]

dbh.disconnect

C:\atest>

Ruby/DBI has moved from Sourceforge to RubyForge. It's new home is

  http://rubyforge.org/projects/ruby-dbi

The newest version is 0.0.23.

Regards,

  Michael

···

On Thu, May 20, 2004 at 08:48:48PM +0900, Shashank Date wrote:

Hello Michael,

"Michael Neumann" <mneumann@ntecs.de> wrote in message
> It's already fixed in CVS, I just need to make a release.
>
> Regards,
>
> Michael

It is still not working for me:
--------------------------------------------------------------------
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd atest

C:\atest>ruby -v tst_dbi_odbc.rb
ruby 1.8.1 (2003-12-25) [i386-mswin32]
"0.0.18"
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 tst_dbi_odbc.rb:5

** After installing the newly released version:

C:\atest>ruby -v tst_dbi_odbc.rb
ruby 1.8.1 (2003-12-25) [i386-mswin32]
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:318: warning: method redefined;
discarding old fraction
"0.0.21"

“Michael Neumann” mneumann@ntecs.de wrote in message

Ruby/DBI has moved from Sourceforge to RubyForge. It’s new home is

http://rubyforge.org/projects/ruby-dbi

The newest version is 0.0.23.

Oops, sorry … I was installing the previous download. My bad!

Now it is working fine. Thanks a lot !
– shanko