http://qs321.pair.com?node_id=856530

lr3p has asked for the wisdom of the Perl Monks concerning the following question:

Hi2All,

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.