This error message was received when attempting to run an NRPE command from the shell. The fill error is below followed by how the issue was resolved.

The error has been posted on the next page because of its length.

Error Message:

[root@server libexec]# perl check_pg_connections.pl dev.example.com test_db
install_driver(Pg) failed: Can't locate DBD/Pg.pm in @INC (@INC contains:
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7
/usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7
/usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5
/usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi
/usr/lib/perl5/5.8.8 .) at (eval 3) line 3.
Perhaps the DBD::Pg perl module hasn't been fully installed,
or perhaps the capitalisation of 'Pg' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge, mysql.
 at check_pg_connections.pl line 24

How to Resolve:
All that’s needs to be done here is to install the Perl Postgres database driver which can be completed by issuing the following command.
shell#yum install perl-DBD-Pg

Once installed you should no longer receive the error above.

More information on Perl can be obtained by reading the book below:

Learning Perl, 5th Edition (Paperback)

By (author): Randal Schwartz, Tom Phoenix, brian d foy


List Price: $39.99 USD
New From: $39.24 USD In Stock
Used from: $6.24 USD In Stock

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , ,
12 Responses to “install_driver(Pg) failed: Can’t locate DBD/Pg.pm in @INC”
  1. Himanshu Porwal says:

    Hi,

    “shell#yum install perl-perl-DBD-Pg” how this command can be used on windows for the same error as mentioned above. As i am facing the same problem which coding Perl in windows.

    Thanks
    himanshu Porwal

    [Reply]

    alex Reply:

    Hello himanshu,

    The specific command that is referenced is actually for a Linux package manager called yum. This command is not available on Windows but the concept is still similar. You need to install the Perl-DBD-Pg Perl package for Windows which can be located at the below URL. Install the below DBD-Pg Perl package for Windows NT, Windows XP, Windows 2000, or Windows 2003 and you should resolve the error.

    http://pgfoundry.org/projects/dbdpgppm/

    Hope that helps. Also I the command which was initially listed as “shell#yum install perl-perl-DBD-Pg” in the article should have really been “shell#yum install perl-DBD-Pg” which I have now corrected in the article.

    Good luck!

    Thanks.
    Alex

    [Reply]

  2. egarcia says:

    In ubuntu:

    sudo aptitude install libdbd-pg-perl

    [Reply]

    alex Reply:

    Hello egarcia,

    Awesome. Thanks for taking the time to post this info as I am sure it will come in handy for others searching for the answer to this error.

    Thanks.
    alex

    [Reply]

  3. Analia says:

    It worked on Fedora 12. Thank you so much!

    [Reply]

    alex Reply:

    Hello Analia,

    No problem. Thanks for taking the time to leave feedback.

    Thanks.
    alex

    [Reply]

  4. Ujjwal says:

    I could install DBD::Pg using yum in fedora 10. Thanks for that.

    However, I could not execute my simple database connection test program. It gives the following error –

    install_driver(Pg) failed: DBD::Pg object version 2.13.1 does not match bootstrap parameter 2.17.2 at /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/DynaLoader.pm line 226.
    Compilation failed in require at (eval 3) line 3.

    Any suggestions on that?

    Thanks,
    Ujjwal

    [Reply]

    alex Reply:

    Hello Ujjwal,

    I was going to suggest a version mismatch but looks like you got it figured out below!

    Thanks.
    alex

    [Reply]

  5. Ujjwal says:

    Well found the problem… Someone had installed DBD-Pg-2.17.2 on the host machine before me.

    What I did to resolve the problem was – downloaded DBD-Pg-2.13.1 and installed it (by following the instructions in readme file).

    Set the lib path in PERL5LIB. Worked fine for me.

    Thanks,
    Ujjwal

    [Reply]

    alex Reply:

    Hello Ujjwal,

    Good to hear! Thanks for taking the time to follow up with the solution you used!

    Thanks.
    alex

    [Reply]

    Ujjwal Reply:

    Hey Alex,

    These are my beginning days with Perl. I surely did find the solution, but did not understand it completely.

    I installed the lib using yum. And then had to download the drive DBD-Pg-2.13.1.tar.gz and install it as well – using perl MakeFile.PL & make commands. It produced Pg.pm file.

    I had to set the path of the DBD/Pg.pm in PERL5LIB and then my program worked.

    I could not understand the difference – what was done by yum? and what did I install using DBD-Pg-2.13.1.tar.gz?

    Can you please enlighten me with that.

    Thanks in advance,
    Ujjwal

    [Reply]

    alex Reply:

    Hello Ujjwal,

    The versions have to match to install properly. So depending on if you installed Perl via yum or via source could have been the problem.

    Thanks.
    alex

    [Reply]

  6.  
Leave a Reply

*Type the letter/number combination in the abvoe field before clicking submit.

*