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



Thanks Martin for your post. I figured it out.

I checked all the env variables it was all correct, I just had to run
"$INSTHOME/sqllib/db2profile" from my shell.

I added this to my ".profile"

if [ -f /home/db2inst1/sqllib/db2profile ]; then
. /home/db2inst1/sqllib/db2profile
fi

-Kannan


On Jan 23, 8:56 am, "Martin" <martin.j.ev...@xxxxxxxxx> wrote:
riderc...@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,
KannanKannan,

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 athttp://dbi.perl.org.- Hide quoted text -- Show quoted text -

.



Relevant Pages