Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Cannot connect Perl to PostgreSQL using ODBC (SQL-IM002) by lr3p

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 04:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found