IBM Support

Cannot load module error when using DB2 Perl driver with DB2 UDB Version 8 and above 64-bit for AIX 5.2

Question & Answer


Question

When using the DB2 Perl driver on DB2 UDB Version 8 and above 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® Universal Database™ (DB2 UDB) client libraries is not supported.

Answer

You must use 64-bit Perl in order to use the 64-bit DB2 UDB client libraries on a 64-bit instance.

To determine which Perl version you have, 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
    ...

In this example, the "use64bitint" and "use64bitall" are both set to a value of "undef". This indicates that the version of Perl being used is not compiled in 64-bit.


How to Set Up 64-bit Perl on AIX® 5.2 and version 6

We recommend a local installation from source. This would be helpful if the person does not have root privileges and wish to install locally.

1. Install Perl

  • Download Perl Source Code from - http://www.perl.com/CPAN/src/
  • Follow these commands to install
    • gzip -d perl-5.8.7.tar.gz
    • tar -xf perl-5.8.7.tar
    • cd perl-5.8.7
    • ./Configure -de -Doptimize="-g" -Dusemultiplicity -Duse64bitall -Dprefix=<install-path>
    • Refer - http://search.cpan.org/~mschilli/Perl-Configure-0.07/lib/Perl/Configure.pm for more configuration options. "-Duse64bitall" is necessary for AIX 64 bit since DB2 libraries are all 64 bit. Install Path can be local-directory like -Dprefix=$HOME/perl
    • make
    • make test
    • make install
  • Now the perl should be installed. After that, make sure that you are using this perl for further use. To do so, add <instll-path>/bin to PATH environment variable using following command.
    • In C Shell setenv PATH $HOME/localPerl/bin:$PATH
    • In Bash export PATH=$HOME/localPerl/bin:$PATH
  • Check the perl installation by issuing the command which perl
  • To check the version info run the command perl -V and you would notice use64bitall=define

2. Install DBI Module
  • Download latest DBI from http://search.cpan.org/~timb/, untar it and cd to the folder.
  • Follow these commands to install.
    • perl Makefile.PL
    • make
    • make test
    • make install

3. Install DBD-DB2 Module
  • Download latest DBD-DB2 from http://www.ibm.com/software/data/db2/perl/, untar it and cd to the folder.
  • Follow these commands to install.
    • Set the DB2 environment variable
      1. In C Shell setenv DB2_HOME $HOME/sqllib
      2. In Bash Shell export DB2_HOME=$HOME/sqllib
    • perl Makefile.PL
    • make
    • make test
    • make install

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

Related Information

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Programming Interface - Other","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"9.5;9.1;8","Edition":"Enterprise;Personal;Workgroup;Express","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21181032