Using Perl DB2 driver (DBD-DB2) with DB2 UDB Version 8 64bit for AIX 5.2

From: Michael Hoy (hoymich_at_gmail.com)
Date: 10/17/04


Date: 17 Oct 2004 07:33:56 -0700

If you're having problems getting DBD-DB2 to work with 64-bit DB2 UDB
V8 for AIX v5.2, check out this technote:

http://www-1.ibm.com/support/docview.wss?rs=71&context=SSEPGG&uid=swg21181032&loc=en_US&cs=utf-8&lang=en

The webpage has the fix attached, but the content is as follows:

Cannot load module error when using DB2 Perl driver with DB2 UDB
Version 8 64-bit for AIX 5.2
 
 Technote (FAQ)
  
Problem
When using the DB2 Perl driver on DB2 UDB Version 8 64-bit for AIX
5.2, you get the following error message:
'/usr/opt/perl5/lib/site_perl/5.8.0/aix-thread-multi/auto/DBD/DB2/DB2.so'
for module DBD::DB2: 0509-022 Cannot load module
/usr/opt/db2_08_01/lib/libdb2.a(shr.o).
You are using a 32-bit Perl or you are not sure whether your Perl is
32-bit or 64-bit.
  
Cause
Using 32-bit Perl to load 64-bit DB2 Client libraries is not
supported.
  
Solution
You must use 64-bit Perl in order to use the 64-bit DB2 Client
libraries on a 64-bit instance.

To verify which Perl version you have, you can run the "perl -V"
command as shown here:

# perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0)
configuration:
 Platform:
   osname=aix, osvers=5.2.0.0, archname=aix-thread-multi
   uname='aix rocky 2 5 000ad7df4c00 '
   config_args=''
   hint=recommended, useposix=true, d_sigaction=define
   usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
   use64bitint=undef use64bitall=undef uselongdouble=undef
   ...

Notice that use64bitint and use64bitall are both set to undef. This
indicates that the version of Perl you are using wasn't compiled in
64-bit.

How to Set Up 64-bit Perl on AIX 5.2

There are two ways to set up a 64-bit Perl environment with the DB2
Perl driver (DBD-DB2) on AIX 5.2:

Option 1 - Using the pre-packaged Perl (recommended):

1.1) Check to see if the Perl eFix is installed.

Run the following command as root:

# emgr -l | grep -i perl
1 S perlconfig 09/23/04 14:41:35 fixes truncated Config.pm for
Perl

If you don't see the "fixes truncated Config.pm for Perl" then the
eFix has not been installed. You can obtain the eFix from your local
AIX support or by sending an email to db2perl@ca.ibm.com. The eFix
(perlconfig.083004.epkg.Z) is also attached below for your
convenience.

To install the eFix, you can run the following command as root:

# emgr -e perlconfig.083004.epkg.Z

See "man emgr" for more options.

1.2) Switch to the prepackaged 64-bit Perl

The file /usr/opt/perl5/README explains how to switch to the
pre-packaged 64-bit Perl.

Run the following script: (as root)
(but check the README to ensure nothing has changed)

#!/bin/ksh
ln -f /usr/opt/perl5/bin/perl5.8.0_64bit /usr/bin/perl
ln -sf /usr/opt/perl5/bin/a2p_64bit /usr/bin/a2p
ln -sf /usr/opt/perl5/bin/cppstdin_64bit /usr/bin/cppstdin
ln -sf /usr/opt/perl5/bin/enc2xs_64bit /usr/bin/enc2xs
ln -sf /usr/opt/perl5/bin/h2ph_64bit /usr/bin/h2ph
ln -sf /usr/opt/perl5/bin/libnetcfg_64bit /usr/bin/libnetcfg
ln -sf /usr/opt/perl5/bin/perlbug_64bit /usr/bin/perlbug
ln -sf /usr/opt/perl5/bin/perlcc_64bit /usr/bin/perlcc
ln -sf /usr/opt/perl5/bin/perldoc_64bit /usr/bin/perldoc
ln -sf /usr/opt/perl5/bin/perlivp_64bit /usr/bin/perlivp
ln -sf /usr/opt/perl5/bin/splain_64bit /usr/bin/splain

Make sure you have a valid compiler installed. To check which compiler
was used to build your pre-packaged 64-bit Perl, use the "perl -V"
command.

1.3) Install the DBI module

Make sure the Perl where you want to install DBI is in the path. The
'which perl' command should return this 64-bit Perl.

If you do not have the latest DBI module, you can download the module
by clicking on the Download link at http://search.cpan.org/~timb/DBI/.
The latest version at the time of this writing is DBI-1.43.

Once you have downloaded DBI-1.43.tar.gz, you can install it via the
following commands:

 gzip -d DBI-1.43.tar.gz
 tar -xf DBI-1.43.tar
 cd DBI-1.43

 perl Makefile.PL
 make
 make test
 make install

1.4) Install the DBD-DB2 module

If you do not have the latest DB2-DB2 module, you can download it from
http://www.ibm.com/software/data/db2/perl/

If you are using the root user id or an id different from your DB2
instance id , then you must first set the DB2_HOME variable to the
location of the DB2 sqllib.

For example, if you installed DB2 64-bit, or the DB2 Development
Client 64-bit to /home/db2inst1/sqllib, then do the following:

 export DB2_HOME=/home/db2inst1/sqllib

Install the DBD-DB2 module using the following commands:
(Assuming the file you downloaded is DBD-DB2-0.78.tar.gz)

 gzip -d DBD-DB2-0.78.tar.gz
 tar -xf DBD-DB2-0.78.tar
 cd DBD-DB2-0.78

 perl Makefile.PL*
 make
 make test
 make install

* Remember to read the README, it contains information about system
requirements.

Option 2 - Building 64-bit Perl from source

2.1) Download the latest stable build from http://www.perl.com

After downloading the stable.tar.gz package, you should rename it.
Once you have renamed the package, for example to perl584.tar.gz, you
will need to issue the following commands:

 gzip -d perl584.tar.gz
 tar -xf perl584.tar

 Configure -Duse64bitall

The installation will prompt you for the location where you want to
install Perl. You can use default locations (which will overwrite any
existing files) or specify a new location.
You may also consider installing into an AFS directory so that this
installation can be shared among all users.

Once the configure command has completed, issue the following
commands:

 make
 make test
 make install

Now that you have built the 64-bit Perl, you can then verify that it
is 64-bit by using the command:

 perl -V

You should see "use64bitall=define".

Make sure the Perl where you want to install DBI is in the path. I.e
'which perl' should return this 64-bit Perl.

2.2) Install the DBI module
Please see the documentation for Option 1 on this same step.

An example:

 gzip -d DBI-1.43.tar.gz
 tar -xf DBI-1.43.tar
 cd DBI-1.43

 perl Makefile.PL
 make
 make test
 make install

2.3) Install the DBD-DB2 module
Please see the documentation for Option 1 on this same step.

An example:

 gzip -d DBD-DB2-0.78.tar.gz
 tar -xf DBD-DB2-0.78.tar
 cd DBD-DB2-0.78

 perl Makefile.PL*
 make
 make test
 make install

* Remember to read the README, it contains information about system
requirements.



Relevant Pages

  • Re: attempt to build 64 bit on Solaris fails
    ... > libraries needed to link with a 64-bit Tk. ... We were running a 32-bit version of Perl ... > Each section below is a summary of the commands used to install it. ...
    (comp.lang.perl.tk)
  • Re: attempt to build 64 bit on Solaris fails
    ... libraries needed to link with a 64-bit Tk. ... We were running a 32-bit version of Perl ... Each section below is a summary of the commands used to install it. ...
    (comp.lang.perl.tk)
  • Re: DBI/DBD::DB2
    ... you don't compile a module in the Perl install tree - you compile ... Perhaps the capitalisation of DBD 'DB2' isn't right. ...
    (perl.dbi.users)
  • Perl on Linux and SQL Server 2000 on Windows
    ... There was a time when I did a lot of searching on ways to use Perl ... sitting on Linux to connect SQL Server 2000 sitting on Windows. ... cpan> install DBI ... Install FreeTDS ...
    (comp.os.linux.misc)
  • RE: Please Help !!! Unable to install DBD-Oracle ( I am using perl 5.6 on solaris 8)
    ... Ron, I could be way off here, but the OP mayalready have Perl ... think the original issue was that he tried to use *PPM* to install ... I don't have any Solaris ... you are not the intended recipient, please notify the sender at Wipro ...
    (perl.dbi.users)