Discussion:
Perl DBI and ODBC module
(too old to reply)
BigDaDDY
2004-01-07 17:43:02 UTC
Permalink
I am trying to connect to a Microsoft Access database from a dual-boot
Linux machine. My code is as follows:

#!/usr/bin/perl -w

use DBI;

my $dbh = DBI->connect( "dbi:ODBC:driver=Microsoft Access Driver
(*.mdb);dbq=/mnt/windows/matt.mdb", '', '' );

#End of code

However, when I run this script I get this error

install_driver(ODBC) failed: Can't locate loadable object for module
DBD::ODBC in @INC at (eval 1) line 3
Compilation failed in require at (eval1) line 3.
Perhaps a module that DBD::ODBC requires hasn't been fully installed at
./test.pl line 9

Does anyone know what may be causing this?

Thanks.
Sherm Pendley
2004-01-07 19:26:54 UTC
Permalink
Post by BigDaDDY
install_driver(ODBC) failed: Can't locate loadable object for module
Compilation failed in require at (eval1) line 3.
Perhaps a module that DBD::ODBC requires hasn't been fully installed at
./test.pl line 9
Does anyone know what may be causing this?
The error message means precisely what it says: DBD::ODBC is either
incorrectly installed, or not installed at all.

sherm--
Bill Segraves
2004-01-07 23:33:12 UTC
Permalink
"Ben Morrow" <***@morrow.me.uk> wrote in message news:bthmj4$f90$***@wisteria.csv.warwick.ac.uk...
<snip>
However, your whole approach is futile. The only way to read a .mdb
file is to connect to a running instance of Access, and you can't do
that while you're booted into Linux, unless you use VMware or such.
Ben, there are several ways to read a .mdb file, some of which do not
require a running instance of Access; but rather, require a (User|System)
DSN defined on the Win32 box that hosts the .mdb file. In fact, Access need
not be installed at all; although it might be convenient to use it to
inspect Access databases.

IMO, a simple approach for the OP would be:

1. With a Win32 box, set up a (User|System)DSN (Start + Settings + Control
Panel + ODBC Data Sources (32bit) + M$ Access Driver) to which you can make
the connection.
2. Use a Perl script, e.g., the script on page 107 of the Cheetah Book,
modified to suit your needs, hosted on the Win32 box in 1 above.
3 (tested). Run the script in 2. above from the command line, redirecting
the output to a file in a folder for which you have created a share so your
Linux box can *see* the file.
4 (tested as localhost on Win32 box and from Linux box on LAN with Win32
box). Alternatively, use a CGI script similar to the script in 3. above,
hosted on an Apache server, e.g., IndigoPerl, www.indigostar.com, running on
the Win32 box.

Cheers,
--
Bill Segraves
Ben Morrow
2004-01-08 01:06:22 UTC
Permalink
Post by Bill Segraves
<snip>
However, your whole approach is futile. The only way to read a .mdb
file is to connect to a running instance of Access, and you can't do
that while you're booted into Linux, unless you use VMware or such.
Ben, there are several ways to read a .mdb file, some of which do not
require a running instance of Access; but rather, require a (User|System)
DSN defined on the Win32 box that hosts the .mdb file. In fact, Access need
not be installed at all; although it might be convenient to use it to
inspect Access databases.
OK. I didn't know that... However, my main point still stands, that
trying to read a MDB file off a local Windows partition in Linux is
futile, at least without VMware. I believe this is what the OP is
trying to do.
--
I've seen things you people wouldn't believe: attack ships on fire off the
shoulder of Orion; I've watched C-beams glitter in the darkness near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. |-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-| ***@morrow.me.uk
Bill Segraves
2004-01-08 04:49:56 UTC
Permalink
"Ben Morrow" <***@morrow.me.uk> wrote in message news:btiaee$rer$***@wisteria.csv.warwick.ac.uk...
<snip>
Post by Ben Morrow
OK. I didn't know that... However, my main point still stands, that
trying to read a MDB file off a local Windows partition in Linux is
futile,
I agree. I was just trying to show the OP an approach that *is* workable.
Post by Ben Morrow
at least without VMware. I believe this is what the OP is
trying to do.
Yes, it appears the OP was trying to access the mounted file directly. I
haven't run across a way to do it, either.

Cheers.
--
Bill Segraves

Ben Morrow
2004-01-07 19:27:32 UTC
Permalink
Post by BigDaDDY
I am trying to connect to a Microsoft Access database from a dual-boot
#!/usr/bin/perl -w
use DBI;
my $dbh = DBI->connect( "dbi:ODBC:driver=Microsoft Access Driver
(*.mdb);dbq=/mnt/windows/matt.mdb", '', '' );
#End of code
However, when I run this script I get this error
install_driver(ODBC) failed: Can't locate loadable object for module
Compilation failed in require at (eval1) line 3.
Perhaps a module that DBD::ODBC requires hasn't been fully installed at
./test.pl line 9
DBD::ODBC isn't installed correctly.

However, your whole approach is futile. The only way to read a .mdb
file is to connect to a running instance of Access, and you can't do
that while you're booted into Linux, unless you use VMware or such.

Ben
--
Musica Dei donum optimi, trahit homines, trahit deos. |
Musica truces mollit animos, tristesque mentes erigit. | ***@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras. |
Loading...