dbTalk Databases Forums  

perl4 with DB2?

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss perl4 with DB2? in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Kenjis Kaan
 
Posts: n/a

Default perl4 with DB2? - 08-25-2003 , 08:48 AM






Anyone know where I can get information on connecting Perl4 to DB2? I
know its easy with the newer version of perl, but I have a need to use
Perl4 to connect to DB2.

Reply With Quote
  #2  
Old   
Philip Nelson
 
Posts: n/a

Default Re: perl4 with DB2? - 08-26-2003 , 07:49 AM






On Mon, 25 Aug 2003 06:48:11 -0700, Kenjis Kaan wrote:

Quote:
Anyone know where I can get information on connecting Perl4 to DB2? I
know its easy with the newer version of perl, but I have a need to use
Perl4 to connect to DB2.
Don't think the DBI and DBD:B2 functions were available under Perl 4.

If you really can't upgrade to Perl 5 (why not ? the source is free) then
you could use the following kludgy method -

my $sql = "db2 'connect to dbname';db2 'select * from
sysibm.systables';db2'connect reset'";

my $results = `$sql`;

then process the results out of the $results variable.

Not nice, but it does work.

You have to do this if you want to run DB2 utilities within Perl anyway
(unless someone builds a module to wrap them).

Note that you need the connect, SQL and disconnect all in one statement.
Because the backticks spawn a new process the connection is (should be :
this doesn't happen with Linux) terminated when the backticks command
ends. So it won't be efficient either (among other things you want to
make sure the database is activated to stop having to set up and tear down
resources every time if this is low usage).

HTH

Phil

HTH

Phil


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.