Re: Not able to connect - But the db2 client utility is working fine




riderchap@xxxxxxxxx wrote:

Hi,
From an AIX box, I am trying to connect to a DB2 (UDB) database within
a Perl script using DBI module and DB2 driver. The connect( ) comand
throws the error "Total Environment allocation failure! Did you set up
your DB2 client environment?". But I am able to connect to the data
source though the DB2 client utility "db2".

This DB2 client utility is working
bash$ db2 connect to MYDBSOUCE user MYID

but this is not working from a Perl script.
DBI->connect("dbi:DB2:MYDBSOURCE", "MYID", "MYPASSW", {RaiseError =>
1});

Also the call "DBI->available_drivers()" is returning the DB2 driver
but "DBI->data_sources( 'DB2' )" is returning nothing.

What could be the issue, any help greatly appreciated.

Thank you,
Kannan

Kannan,

Are you really running the db2 client command (which works) and your
Perl script as the same user in the same environment? I suspect you are
not as you need to set DB2INSTANCE which is most likely set when you
login as the db2 instance user.

Martin

PS. You have posted via google groups and so your post is only seen by
people using google groups. Had you joined the dbi-users list properly
your post would have been seen by many more DBI experts. You can join
the dbi-users list at http://dbi.perl.org.

.



Relevant Pages

  • Re: an approach
    ... > i am working on db2 and need a perl script to delete data from a ... There is a column in that table X lets say Xdate. ... > timestamp format so its creating problems for me. ... to solve it is almost surely within DB2 itself. ...
    (comp.lang.perl.misc)
  • Perl System Calls Within The Same Session (on Sun box)
    ... I wrote a perl script that connects to a db2 database and does some ... $db2Out = `db2 select tabschema, ...
    (comp.sys.sun.misc)
  • Perl System Calls Within The Same Session (on Sun box)
    ... I wrote a perl script that connects to a db2 database and does some ... $db2Out = `db2 select tabschema, ...
    (comp.sys.sun.apps)
  • Entering a TimeStamp value into DB2
    ... I have been able to write a perl script which can ... enter an 'integer' or 'varchar' value into a DB2 table. ... enter a 'TimeStamp' value into the same table. ...
    (perl.dbi.users)
  • Re: Not able to connect - But the db2 client utility is working fine
    ... throws the error "Total Environment allocation failure! ... source though the DB2 client utility "db2". ... Perl script as the same user in the same environment? ... your post would have been seen by many more DBI experts. ...
    (perl.dbi.users)