I have a System DSN called "testodbc" on a Windows 2003 server connected to an Access 2003 mdb file called testodbc.mdb. It has one table called "testtable" and one field called "testfield" of type "text".
I would like to perform INSERTS and SELECTS (at a minimum) using the Perl DBI (specifically DBD::ODBC). When I tried "perl -MCPAN -e shell" and "install DBD::ODBC" I got the following:
The DBD::ODBC module needs to link with an ODBC 'Driver Manager'.
(The Driver Manager, in turn, needs one or more database specific ODBC
drivers. The DBD::ODBC module does _not_ include any ODBC drivers!)
You need to indicate where your ODBC Driver Manager is installed.
You can do this ether by setting the ODBCHOME environment variable
or by running 'perl Makefile.PL -o odbcdir'.
If you do not have an ODBC Driver Manager you should try to get hold of
the unixODBC packages for your system or build it from source (see
I installed unixODBC using yum, "yum install unixODBC" and had no problems. Most of the instructions (such as the three EasySoft primers linked off of the http://www.unixodbc.org
) seem to focus on you already having DBD::ODBC installed, and also seem to focus more on setting up a DSN on the Linux server, and accessing it. I already have the DSN, on the Windows server, so I just need to access it from my Perl scripts on a Linux server.
So, how do we:
1. Get DBD::ODBC installed using the unixODBC Driver Manager
2. Ensure that we have a driver in unixODBC for Microsoft Access to access my testodbc System DSN
3. Come up with the connect script in Perl (like the following, but would port 1433 be right here)
$dbh = DBI->connect("dbi:ODBC:dbn
4. Assign a username and password to the ODBC connection under Windows, so I can put that into my connect string above and keep others from accessing it easily.
5. Once I'm that far, it should be as easy as with any other database using the Perl DBI, unless you can think of any other issues?