Thread: postgresql perl connectivity

postgresql perl connectivity

From
Jay
Date:
hi people
i am trying to connect to ppstgresql on a debian system using perl . i
am getting the following error .can any one please suggest what has to
be done


install_driver(pg) failed: Can't locate DBD/pg.pm in @INC (@INC
contains: /etc/perl /usr/local/lib/perl/5.8.3
/usr/local/share/perl/5.8.3 /usr/lib/perl5 /usr/share/perl5
/usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at
(eval 1) line 3.
Perhaps the DBD::pg perl module hasn't been fully installed,
or perhaps the capitalisation of 'pg' isn't right.
Available drivers: ExampleP, Pg, Proxy, Sponge, mysql.
 at psqldb.pl line 10


 thanks
jay

Re: postgresql perl connectivity

From
"Scot L. Harris"
Date:
On Sun, 2004-06-27 at 21:05, Jay wrote:
> hi people
> i am trying to connect to ppstgresql on a debian system using perl . i
> am getting the following error .can any one please suggest what has to
> be done
>
>
> install_driver(pg) failed: Can't locate DBD/pg.pm in @INC (@INC
> contains: /etc/perl /usr/local/lib/perl/5.8.3
> /usr/local/share/perl/5.8.3 /usr/lib/perl5 /usr/share/perl5
> /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at
> (eval 1) line 3.
> Perhaps the DBD::pg perl module hasn't been fully installed,
> or perhaps the capitalisation of 'pg' isn't right.
> Available drivers: ExampleP, Pg, Proxy, Sponge, mysql.
>  at psqldb.pl line 10
>
>
>  thanks
> jay

I have not done much perl programming but it looks like you need to
install the CPAN DBD package.


--
Scot L. Harris <webid@cfl.rr.com>


Re: postgresql perl connectivity

From
"Scot L. Harris"
Date:
On Sun, 2004-06-27 at 21:19, Jay wrote:
> i did a apt-get install on my machine .my mysql connectivity works fine
> though .
>

Even so the error message is saying it can't locate DBD/pg.pm followed
by the include list as well as hinting that the DBD::pg package, which
provides the perl interface to postgresql, has not been fully installed.

If I was in your place I would run the perl CPAN stuff and reinstall the
DBD::pg package then verify that the pg.pm file is on the system and in
one of the include directories.


> "Scot L. Harris" <webid@cfl.rr.com> wrote:
> > On Sun, 2004-06-27 at 21:05, Jay wrote:
> >>> hi people
> >> i am trying to connect to ppstgresql on a debian system using perl
> >> . i am getting the following error .can any one please suggest what
> >> has to be done
> >>
> >>
> >> install_driver(pg) failed: Can't locate DBD/pg.pm in @INC (@INC
> >> contains: /etc/perl /usr/local/lib/perl/5.8.3
> >> /usr/local/share/perl/5.8.3 /usr/lib/perl5 /usr/share/perl5
> >> /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .)
> >> at (eval 1) line 3. Perhaps the DBD::pg perl module hasn't been
> >> fully installed, or perhaps the capitalisation of 'pg' isn't right.
> >>  Available drivers: ExampleP, Pg, Proxy, Sponge, mysql. at
> >> psqldb.pl line 10
> >>
> >>
> >> thanks jay
> >
> > have not done much perl programming but it looks like you need to
> > nstall the CPAN DBD package.
> >
> > - Scot L. Harris <webid@cfl.rr.com>
--
Scot L. Harris <webid@cfl.rr.com>


Re: postgresql perl connectivity

From
"Scot L. Harris"
Date:
On Sun, 2004-06-27 at 21:56, Jay wrote:
> i finally got that working . thanks for ur suggestion . i downloaded the
> DBD/pg.pm from cpan and it works fine now .
> it would be great it u could help me with a bit of perl also. i am
> getting an error when i am trying to execute the program
> DBD::Pg::st execute failed: ERROR:  syntax error at or near "(" at
> character 81 at psqldb.pl line 14.
>   there is nothing at line 14 character 81
> thanks
> kay
>
Like I said in my initial message I have not done much perl
programming.

Without source code it is impossible for anyone to debug your script for
you.  But note that it says you have a syntax error at or NEAR "(" on
line 14.  You need to review all the code in that area of your script.
You probably have a typo that can easily be corrected.

If you have additional perl programming questions you may want to post
on a perl mailing list.

> "Scot L. Harris" <webid@cfl.rr.com> wrote:
> > On Sun, 2004-06-27 at 21:05, Jay wrote:
> >>> hi people
> >> i am trying to connect to ppstgresql on a debian system using perl
> >> . i am getting the following error .can any one please suggest what
> >> has to be done
> >>
> >>
> >> install_driver(pg) failed: Can't locate DBD/pg.pm in @INC (@INC
> >> contains: /etc/perl /usr/local/lib/perl/5.8.3
> >
> > have not done much perl programming but it looks like you need to
> > nstall the CPAN DBD package.
> >
--
Scot L. Harris
webid@cfl.rr.com

What is food to one, is to others bitter poison.
        -- Titus Lucretius Carus


Re: postgresql perl connectivity

From
Alvaro Herrera
Date:
On Sun, Jun 27, 2004 at 07:05:13PM -0600, Jay wrote:

> Perhaps the DBD::pg perl module hasn't been fully installed,
> or perhaps the capitalisation of 'pg' isn't right.
> Available drivers: ExampleP, Pg, Proxy, Sponge, mysql.
> at psqldb.pl line 10

So, did you try using the Pg driver rather than pg ?  It seems in this
case capitalisation matters ...

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"En las profundidades de nuestro inconsciente hay una obsesiva necesidad
de un universo lógico y coherente. Pero el universo real se halla siempre
un paso más allá de la lógica" (Irulan)


Re: postgresql perl connectivity

From
Richard Huxton
Date:
Alvaro Herrera wrote:
> On Sun, Jun 27, 2004 at 07:05:13PM -0600, Jay wrote:
>
>
>>Perhaps the DBD::pg perl module hasn't been fully installed,
>>or perhaps the capitalisation of 'pg' isn't right.
>>Available drivers: ExampleP, Pg, Proxy, Sponge, mysql.
>>at psqldb.pl line 10
>
>
> So, did you try using the Pg driver rather than pg ?  It seems in this
> case capitalisation matters ...

It does indeed, since the module-name is the same is its filename and
unix has case-sensitive file-systems (hmm - what would happen on Windows?)

Jay - a quick tip with these is that "perldoc DBD::Pg" will show the
docs for the module in question, or an error if it can't find the module.

--
   Richard Huxton
   Archonet Ltd

Re: postgresql perl connectivity

From
jseymour@linxnet.com (Jim Seymour)
Date:
Alvaro Herrera <alvherre@dcc.uchile.cl> wrote:
>
> On Sun, Jun 27, 2004 at 07:05:13PM -0600, Jay wrote:
>
> > Perhaps the DBD::pg perl module hasn't been fully installed,
> > or perhaps the capitalisation of 'pg' isn't right.
> > Available drivers: ExampleP, Pg, Proxy, Sponge, mysql.
> > at psqldb.pl line 10
>
> So, did you try using the Pg driver rather than pg ?  It seems in this
> case capitalisation matters ...

Indeed it does.  The module is DBD::Pg, *not* DBD::pg.

use DBI:
$dbh = DBI->connect("dbi:Pg:dbname=$dbName", $dbUser, $dbPass, [...]);

Jim