lr3p has asked for the wisdom of the Perl Monks concerning the following question:
Perl newbie debuting here. I have encountered the following persistent problem.
Using:
- Windows XP Professional SP3
- ActivePerl 5.12.1 Build 1201
- PostgreSQL 8.4.4
According to PPM I have the following relevant drivers installed (all up-to-date):
- DBI 1.613
- DBD-ODBC 1.24 (ODBC DBD for Perl DBI)
But when trying to execute the following simple program:
#!usr/bin/perl use warnings; use diagnostics; use strict; use DBI; my $driver = "ODBC"; my $dbname = "test"; my $dsn = "dbi:$driver:$dbname"; my $username = "postgres"; my $password = "************"; my $dbh = DBI->connect($dsn, $username, $password, {PrintError => 0, R +aiseError => 1}) || die "Error $DBI::err [$DBI::errstr]"; print "Connected: State is %s\n", $dbh -> state || "OK"; $dbh->disconnect;
I get the following error message:
Uncaught exception from user code:
DBI connect('test', 'postgres',...) failed: MicrosoftODBC Driver Manager Data source name not found and no default
driver specified. (SQL-IM002) at DB_test.plx line 16
at C:/Perl/site/lib/DBI.pm line 675
DBI::__ANON__(undef, undef) called at C:/Perl/site/lib/DBI.pm line 730
DBI::connect('DBI', 'dbi::ODBC::test', 'postgres', '************', 'HASH(0x298dcc)') called at DB_test.plx line 14
After looking for a solution for hours I still can't figure out what's the problem, so in desperation I turn to thy sages of Perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cannot connect Perl to PostgreSQL using ODBC (SQL-IM002)
by Corion (Patriarch) on Aug 22, 2010 at 07:27 UTC | |
|
Re: Cannot connect Perl to PostgreSQL using ODBC (SQL-IM002)
by lr3p (Initiate) on Aug 22, 2010 at 11:33 UTC | |
by afoken (Chancellor) on Aug 23, 2010 at 06:23 UTC | |
by mpeppler (Vicar) on Aug 24, 2010 at 12:27 UTC | |
by Anonymous Monk on Aug 23, 2010 at 06:51 UTC |