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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.