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

Hi,

I want to write a perl script to connect to DB2.

I have ActivePerl 5.8.0 installed in my machine.

I have installed the following modules through ppm install.

DBD-DB2 and DBI modules.

It was successfully installed.

I have written sample program which is
#!/usr/bin/perl use strict; use DBI; my $dbh = DBI->connect("dbi:DB2:DATABASE=db","user","pwd") || die "err +or in connecting";
Its throwing error :
install_driver(DB2) failed can't load 'C:/Perl/site/lib/auto/DBD/DB2/DB2.dll' for module DBD::DB2: load_file: the specified procedure could not be found at C:/Perl/lib/DynaLoader.pm

Compilation failed in require at <eval 2> line 3 Perhaps required shared library or dll isn't installed where expected..

Kindly help me to resolve this issue.

Replies are listed 'Best First'.
Re: DBD -DB2 error
by Anonymous Monk on Jun 03, 2009 at 08:11 UTC
    You should have also received
    Application popup: perl.exe - Unable To Locate Component : This applic +ation has failed to start because DB2APP.dll was not found. Re-instal +ling the application may fix this problem.
    http://cpansearch.perl.org/src/IBMTORDB2/DBD-DB2-1.71/README
    *** *BEFORE* BUILDING, TESTING AND INSTALLING this you will need to: Build, test and install Perl 5 (Preferrably 5.006_00 or later) It is very important to TEST it and INSTALL it! Build, test and install the DBI module (at least DBI 1.21). It is very important to TEST it and INSTALL it! Remember to *read* the DBI README file and this one CAREFULLY! Ensure the following DB2 product is installed. DB2 Application Development Client v7.2 or later Included with the DB2 Personal Developer's Edition and the DB2 Universal Developer's Edition The Application Development Client can be downloaded here: http://www.ibm.com/software/data/db2/udb/support/

      I have already installed DB2 v9.5 client and set environment variable DB2_HOME="C:\Program Files\IBM\SQLLIB\.