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

I need to connect to a postrgres database with perl.

a. Is the only way to do so using DBI? My system
administrator is on vocation so I don't think I can install
a driver for to weeks (don't have the superuser access), so
is there any other way?

b. Is it true that the latest verion of Perl has DBI
support built in? I have version 5.004_04.

c. If DBI is the only choice where can I get the latest

Thanx a lot,


Replies are listed 'Best First'.
Re: Perl to Postyrgess
by httptech (Chaplain) on Jun 24, 2000 at 21:29 UTC
    There are alternate PostgreSQL interface modules such as Pg, Postgres and PgSQL.

    They are all modules like DBI, so there's no advantage in terms of being able to install without being superuser. But you don't need to be superuser, just install the modules into your own account and use the 'use lib' directive to point perl to your additional libraries.

    I don't think DBI is built into any version of Perl, especially 5.004_04 which is fairly dated.

    You can get all the above modules and the DBI drivers from CPAN.

Re: Perl to Postyrgess
by mdillon (Priest) on Jun 24, 2000 at 21:29 UTC
    no, DBI is not the only way. there is also a Perl interface to PostgreSQL that comes as part of the PostgreSQL distribution called Pg. if it was not installed by your administrator, you'll have a harder time installing it than DBI/DBD::Pg. try running perl -MPg to see if you have the Pg module installed.

    as for not being able to install DBI because you are not root, you should see How do I keep my own module/library directory?.

    no version of Perl has DBI built-in (except perhaps a specific port).

Re: Perl to Postyrgess
by JanneVee (Friar) on Jun 24, 2000 at 21:24 UTC
Re: Perl to Postyrgess
by davorg (Chancellor) on Jun 25, 2000 at 13:26 UTC

    DBI isn't a standard part of Perl yet.

    To install it you'll to get DBI and also DBD::Postgres (both available on CPAN).

    You don't necessarily need your sysadmin in order to get this stuff installed. It is possible to install private copies of modules. See perlman:perlmodinstall for details.


    European Perl Conference - Sept 22/24 2000
RE: Perl to Postyrgess
by jjhorner (Hermit) on Jun 26, 2000 at 06:01 UTC

    As for 'a', try this:

    % perl Makefile.PL LIB=/home/joseph/perllib

    The above comes from Item 41 of Effective Perl Programming by our own merlyn and Joseph N. Hall.

    J. J. Horner
    Linux, Perl, Apache, Stronghold, Unix