From: Jean-Michel V. <con...@ni...> - 2013-07-03 16:07:59
|
On Monday 24 June 2013 14:11:28 Sebastian Reinhardt wrote: > Hi, > In past I have used mdb-tools- command line utils for reading data from > an mdb-file. Now I try to write an perl script by using DBD::ODBC and > libmdbodbc- driver. > But I can connect to mdb-file, if I put the database information in my > "~/.odbc.ini"- file ,only! > If I use this "ini-file"- input with this connect line: > my $dbh = DBI->connect('DBI:ODBC:MDBDSN', $user, $pass, { RaiseError => 1}); > in my Perl script, I can connect to the file. > If I try to connect to the mdb-file with: > my $dbh = > DBI->connect('DBI:ODBC:DRIVER={MDBToolsODBC};database=/mnt/lvm/SNR_Soft/Kivitendo_Import/in/kramp/Kramp.dat' > $user, $pass, { RaiseError => 1}); > it fails with this error: > DBI > connect('DRIVER={MDBToolsODBC};database=/mnt/lvm/SNR_Soft/Kivitendo_Import/in/kramp/Kramp.dat','',...) > failed: [unixODBC]Could not find DSN in connect string (SQL-08001) > > This is my odbc.ini: > ---------- > [MDBDSN] > Description = MDBDSN > Driver = MDBToolsODBC > Database = /mnt/lvm/SNR_Soft/Kivitendo_Import/in/kramp/Kramp.dat > Servername = localhost > Port = 5432 > ---------- > > So why it fails without the ini file? The ini-file is no solution, > because I have to be able to put in different files! You need a valid DSN. This is "not optimal" I agree... :/ The good news is that you can override the database. So connect('DRIVER={MDBToolsODBC};DSN=MDBSN;Database=/mnt/lvm/SNR_Soft/Kivitendo_Import/in/kramp/Kramp2.mdb','',...) might work. Note the capital D in Database. |