Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: DBD::ODBC connection prob

by Rich36 (Chaplain)
on Mar 04, 2003 at 22:08 UTC ( #240464=note: print w/replies, xml ) Need Help??


in reply to DBD::ODBC connection prob

You should just be able to use

my $DSN = 'driver=Microsoft Access Driver(*.mdb);dbq=C:/dyc/dyc.mdb';

I had some problems with that when trying to use Win32::ODBC with a Access database. What I ended up doing was writing a file DSN on the fly, then cleaning it up on exit. That seemed to work a little better for me. It was something like this:

# Create the MS Access DSN my $dsncontents = <<"EODSN"; [ODBC] DRIVER=Microsoft Access Driver (*.mdb) UID=admin UserCommitSync=Yes Threads=3 SafeTransactions=0 PageTimeout=5 MaxScanRows=8 MaxBufferSize=2048 FIL=MS Access DriverId=25 DefaultDir=$datadir DBQ=$file EODSN open(DSN, ">$datadir/Report.dsn") or die "Couldn't create new DSN!\n"; print DSN $dsncontents; close(DSN); $accessdsn = "FILEDSN=$datadir/Report.dsn";

Where I had previously defined the access file name ($file ), data directory ($datadir ) and then used $accessdsn as the parameter for the call. All I did was create a working file DSN for the database, then copy the contents into my application, changing certain elements to variables. In your case, if the datadir and file name are constant, you could probably just have all the values hardcoded or just put a file DSN in with the Access database.


«Rich36»

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://240464]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2021-04-13 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?