I have a few questions:

What's the error message?
What version of the Access ODBC driver are you using?
Do you have access to the path/file?

Regards,

Jeff
> 
> Thanks to Jeff first, but I still failed in both ways either by DSN-less
> connection or by system DSN connnection.
> ....
> #my $dbn="driver=Microsoft Access Driver (*.mdb);dbq=\\\\genethon\\data
> drive\\www\\DB\\newgene.mdb";
> my $dbn="newgene";
> my $dbh=DBI->connect('dbi:ODBC:$dbn','','')|| die "$DBI::errstr\n";
> ...
> where "newgene" is a system DSN I have added.
> 
> I do use DBD::ODBC 0.28.   Any more suggestions?
> 
> Regards
> Haifeng
> 
> ----- Original Message -----
> From: "Jeff Urlwin" <[EMAIL PROTECTED]>
> To: "Liu Haifeng" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, August 28, 2002 8:32 PM
> Subject: RE: Failure of ODBC connection with Access
> 
> 
> > >
> > > Hi,
> > >
> > > I am wondering how to successfully connect to Microsoft Access
> > > database using DBD::ODBC.  Here is the snippet of my code:
> >
> > Use perldoc DBD::ODBC and you will see an example of a DSN-less
> connection,
> > which is what you are trying to do.  Otherwise, setup a system 
> DSN and use
> > DBI->connect("dbi:ODBC:$DSN", etc)
> > >
> > > .....
> > > my $dbdrive=DBI->install_driver('ODBC');
> > > my $dbn="driver=Microsoft Access Driver
> > > (*.mdb);dbq=\\\genethon\\data drive\\www\\DB\\newgene.mdb";
> > > my $dbh=$dbdrive->connect('dbi:ODBC:$dbn','','')|| die 
> "$DBI::errstr\n";
> > > ....
> >
> > Thre are two problems here:
> > 1) you should never need to call install_driver.  Just use 
> DBI->connect()
> > 2) Your dbq= has a missing backslash in front of the server name (3
> instead
> > of 4)
> >
> >
> > > where "genethon" is my PC name and the database file
> > > "newgene.mdb" actually locates under C:\data drive\www\DB.
> > >
> > > The error message is "[Microsoft][ODBC Driver Manager] Data
> > > source name not found and no default driver specified
> > > <SQL-IM002><DBD:db-login/SQLConnect err=-1>"
> > >
> > Also, check which version of DBD::ODBC you are using.  There were some
> > spurious error messages in the .28 when using a long name 
> connecting like
> > this.  I think you'll be ok, but...
> >
> > Regards,
> >
> > Jeff
> >
> >
> 
> 

Reply via email to