Re: DBI/DBD::DB2



On 6/23/06, Kevin.D.Wendt@xxxxxxxxxxxxxx <Kevin.D.Wendt@xxxxxxxxxxxxxx>
wrote:

Hello,
I am trying to write a perl script to connect to our DB2 database and
do some basic SQL queries. But I'm having trouble with making
everything play nice.
I'm on WinXP, and did a manual build of DBI with Visual Studio's
nmake. That all went fine (as far as I can tell). So I downloaded the
DBD::DB2 module and unzipped it to my C:/Perl/lib directory (creating
the blib directory from the use lib line below. Here's the code I'm
trying to test it with...



Normally, you don't compile a module in the Perl install tree - you compile
it some other place and install it into the tree.
So, did you obtain a pre-compiled copy of DBD::DB2?

If so, do you have the necessary support libraries installed?


use lib 'c:/Perl/lib/blib/lib/Bundle';



I'm dubious in the extreme about this line (above).


use DBI;

### Probe DBI for the installed drivers
my @drivers = DBI->available_drivers();

die "No drivers found!\n" unless @drivers; # should never happen

### Iterate through the drivers and list the data sources for
### each one
foreach my $driver ( @drivers ) {
print "Driver: $driver\n";
my @dataSources = DBI->data_sources( $driver );
foreach my $dataSource ( @dataSources ) {
print "\tData Source is $dataSource\n";
}
print "\n";
}


And here is the output:

DBD::DB2 initialisation failed: Can't locate object method "driver" via
package "DBD::DB2" at c:/Perl/site/lib/DBI.pm line 768.

Perhaps the capitalisation of DBD 'DB2' isn't right. At
C:..........dbQueryAutoBatch.pl line 33.


If you have a pre-compiled module, then I think your problem is the absence
of DB2 Connect (IIRC) or its equivalent.
If you don't have a pre-compiled module, then your problem is that you need
to compile and install it - and compile it in any directory that is not
underneath the Perl install directory hierarchy.

Not sure if DBI or DBD::DB2 arne't right or I'm just calling something
wrong. But any help would be appreciated.


There's a chance I misinterpreting the symptoms - I'm not a DB2 expert.

--
Jonathan Leffler <jonathan.leffler@xxxxxxxxx> #include <disclaimer.h>
Guardian of DBD::Informix - v2005.02 - http://dbi.perl.org
"I don't suffer from insanity - I enjoy every minute of it."


Relevant Pages

  • RE: DBI compile on HPUX-11.23
    ... I am literally in the process of building perl 5.8.7 on Itanium ... Subject: DBI compile on HPUX-11.23 ... since there's no INSTALL document I'm having problem with the ...
    (perl.dbi.users)
  • Re: Compiling C source on OSR5.07
    ... I can't compile anything in C, for example, I'm trying to ... > install Date::Calc and DateTime for Perl, but I get so many missing header ... Perl used to be so simple, ... I'm assuming this was fixed in mp4, ...
    (comp.unix.sco.misc)
  • Using Perl DB2 driver (DBD-DB2) with DB2 UDB Version 8 64bit for AIX 5.2
    ... If you're having problems getting DBD-DB2 to work with 64-bit DB2 UDB ... Cannot load module error when using DB2 Perl driver with DB2 UDB ... Run the following command as root: ... To install the eFix, you can run the following command as root: ...
    (perl.dbi.users)
  • Re: DBD-Oracle-1.14 and Oracle 9i
    ... to install and run with it. ... Should I be able to compile for Oracle 9/64bit on Solaris? ... >> Building perl with nothread ...
    (perl.dbi.users)
  • RE: Cant locate DBI.pm
    ... Install the C compiler used to build your Perl and then try to install DBI and DBD::Oracle ... You will need to compile these yourself. ...
    (perl.dbi.users)