CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Help in connecting to the database using DBI

 



datlaravi
Deleted

Aug 21, 2000, 10:13 PM

Post #1 of 2 (406 views)
Help in connecting to the database using DBI Can't Post

Hi,
I need some help in connecting to Access database.
I was running the below code and i am getting the error

$dbh = DBI->connect("dbi:ODBC:db1.mdb");
The error is
DBI->connect(db1.mdb) failed. data source name not found and no default driver specified.(SQL-IM002) (DBD: db_login/sqlconnect err-1)

I have installed odbc drivers by going to the dos prompt (ppm and after that install
dbd-odbc)
I have launched odbc drivers in control panel
and added 'system dsn' as 'ODBC' and selected a database(which i have created in Access db1.mdb)
Please help me what might be wrong in the connect statement
Thanks


Kanji
User / Moderator

Aug 21, 2000, 10:29 PM

Post #2 of 2 (407 views)
Re: Help in connecting to the database using DBI [In reply to] Can't Post

  <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">quote:</font><HR>data source name not found<HR></BLOCKQUOTE>
You didn't configure Windows to recognize db1.mdb as a valid datasource in Control Panel -> ODBC Data Source -> System DSNs (hint: you may not have called your DSN the same as the filename).
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">quote:</font><HR>and no default driver specified<HR></BLOCKQUOTE>
Since db1.mdb isn't a DSN, it must be a file, but you didn't tell DBD::ODBC which driver to use to read that file so it has no idea whether its really an Access db, an Excel spreadsheet, or something else entirely.

So your options are ...

Set a DSN, and connect to that.

See the DBD::ODBC documentation for explicit details on how to connect to an Access database w/o setting a DSN.

[This message has been edited by Kanji (edited 08-22-2000).]

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives