Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBI using ODBC for MS Access Database

Status
Not open for further replies.

nwyork

Programmer
Oct 23, 2004
26
0
0
US
I'm trying to learn how to use DBI, but I can't get pass the connect
method.

I'm using:

my $dbh = DBI->connect('DBI:ODBC:Northwind','admin','password');

The part I'm not sure about is the datasource.
Everytime I get:

DBI connect('Northwind','admin',...) failed: [Microsoft][ODBC Driver
Manager] Da
ta source name not found and no default driver specified (SQL-IM002)
(DBD: db_log
in/SQLConnect err=-1) at dbi_test.pl line 3

OR:

DBI connect('Northwind','admin',...) failed: [Microsoft][ODBC Driver
Manager] Da
ta source name not found and no default driver specified (SQL-IM002)
(DBD: db_log
in/SQLConnect err=-1) at dbi_test.pl line 3

I've tried many different things, such as using the full paths for the data source name. I have even tried moving the odbc driver and database into my current working directory.

Thanks in advance for any help,
Nick
 
Create a Data Source Name (DSN) which points to your database, and it should be alright after that

--Paul

Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
Thanks for your help, but I've tried that already. Is dbi set to go after perl is installed or does need to be configured? I'm kinda of lost with this I might try installing a new ODBC driver for access.
 
try
Code:
ppm query dbi
assuming ActvePerl

--Paul

Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
When I tried the query for DBI it did not show any results. So Installed DBI thinking that could be the resolution. Also I installed MDAC 2.6 just to be safe on the obdc driver, but still no go. This is very frustrating I might just download a different dbms and create a new database at this point.
 
think of your goal

set your sights on it

if it's feasible, it's do-able (and probably beeen done)

Google ==>DBI access

you're not the first, you won't be the last

--Paul

I've seen no code, so I'm not trying too hard ... just a personal perspective ...




Nancy Griffith - songstress extraordinaire,
and composer of the snipers anthem "From a distance ...
 
Northwind generally refers to a SQL Server database, not an Access one. Which are you aiming for?

________________________________________
Andrew

I work for a gift card company!
 
The Northwind database I'm using is for MS Access, but I'm installing Oracle 10 to try out the driver on it. I think this will help narrow down where I went wrong with the first program I created.

Thanks for your help,
Nick
 
When you're setting up the DSN for the database you want to connect to, be sure it's being set up as a System DSN. User DSNs won't work.

- Rieekan
 
Hey Rieekan, thats what I was doing wrong. I tried once setting up a system dsn but I don't think I used the right name for that one. Thanks everybody for the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top