Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Connect to DB2 Database with Perl DBI in Windows 7

by concerto5 (Novice)
on Aug 17, 2015 at 19:26 UTC ( [id://1138920]=perlquestion: print w/replies, xml ) Need Help??

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

Hi all Monks. First time post. Have been using Perl for about a year now and want to connect to my companies' database to speed up data retrieval. My company is using DB2. I have strawberry Perl 32-bit and Windows 7 64-bit. I honestly do not know where to start. The reason I say this is because it seems like connecting to DB2 requires a bit more legwork than other databases. As of now, I simply have Perl DBI installed and that's it. Any advice (remember I am a novice) on how to begin in order to connect to a DB2 database? Thanks.
  • Comment on Connect to DB2 Database with Perl DBI in Windows 7

Replies are listed 'Best First'.
Re: Connect to DB2 Database with Perl DBI in Windows 7
by dasgar (Priest) on Aug 17, 2015 at 21:08 UTC

    I haven't used DB2 in any capacity, but I'm thinking that Corion's suggestion makes sense - install needed client before installing DBD::DB2.

    Alternatively, I'm wondering if there is an ODBC driver for DB2 access. If there is, then installing that and using DBD::ODBC might work too.

    In any case, I suspect that you'll need to install some kind of DB2 driver and/or client before you can gain access via any Perl modules.

Re: Connect to DB2 Database with Perl DBI in Windows 7
by pme (Monsignor) on Aug 17, 2015 at 19:42 UTC
      Thanks for the reply. When installing in CPAN i get the following error: Failed during this command: IBMTORDB2/DBD-DB2-1.85.tar.gz : writemakefile NO 'C:\Strawberry\perl\bin\perl.exe Makefile.PL' returned status 512

        See this issue report, which suggests that the problem is because the code doesn't compile with the gcc bundled with Strawberry Perl.

        I believe that the core issue is gcc compiler support under Windows. T +here is a history here... that shows that in 2010, a patch was contributed +for DBD::DB2 1.78 for gcc on Windows. DBD::DB2 1.85, the current versio +n on CPAN, doesn't include this patch (or it no longer works).
        The way forward always starts with a minimal test.
        Can you see this message couple of lines above? "DB2_HOME environment variable must be set to installed location of DB2." This may be the reason. I have never used DB2.
Re: Connect to DB2 Database with Perl DBI in Windows 7
by anonymized user 468275 (Curate) on Aug 18, 2015 at 09:27 UTC
    If you are missing dependencies, there is also Bundle::DBD::DB2 that includes them as well. If that doesn't install, you could try downloading the tarball (.tar.gz file) by clicking on the breadcrumb in front of the above name, and then on the download link and the file will download. Use 7-zip or similar archive software to extract firstly from the .gz and then extract again from the resulting .tar file, then in a DOS prompt: cd to where you extracted from .tar, then
    perl Makefile.PL dmake dmake test dmake install

    One world, one people

Re: Connect to DB2 Database with Perl DBI in Windows 7
by rahulruns (Scribe) on Aug 20, 2015 at 04:46 UTC

    Try using active state Perl. Could solve your problem. I have used it and pretty much things are available. If you are using PPM to install try using cpan command line. Just suggestions

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1138920]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-26 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found