Hello Kind and Wise Monks:

I am certain that one of your members will be able to assist me. I am attempting to connect to a postgres 8.2 database using DBI. Here are some details that may help Postgresql is install on my local machine under Windows. Within postgres in postgresql.conf listen_adresses is selected and set to *. Listen to all IP addresses?
And port is set to default 5432.
I am using Active Perl 5.8.8 with DBI 1.52 and DBD-Pg 1.45 installed.

My code follows:
use DBI; my $dsn = "dbi:Pg:dbname='benchmark_c';host='localhost'" ; my $dbname = 'benchmark_c'; my $host = 'localhost' ; my $port = '5432'; my $uname = "postgres"; my $pword = "postgres"; #** ** $dbh = DBI->connect("dbi:Pg:dbname=$dbname;host=$host;port=$por +t", "$uname", "$pword"); #** ** $dbh = DBI->connect("dbi:Pg:dbname=$dbname", "$uname", "$pword" +); $dbh = DBI->connect("dbi:Pg:dbname='benchmark_c';host='localhost'", "' +postgres'", "'postgres'"); print "connected"; $stmt = $dbh->prepare("select appsyskey from appsys where upper(appsys +name) = 'LOAD LEHMAN TRADES'"); $stmt->execute(); my $rslts = $stmt->fetchrow_hashref(); my $appsyskey = $rslts->{'appsyskey'}; print $appsyskey;
Perl is actually blowing up. First time I have seen that. Makes me sad.
Your kind assistance is requested.

thanks
kd

In reply to connecting to postgresql with DBI by kevind0718

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.