You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by iv <iv...@fnet.pl> on 2006/06/01 10:34:04 UTC

connection to ibm db2 database

hello

i've got a problem with connection to my database - db2.

i'm trying to esteblish it from a mod_perl module; every time i get an
error "null: DBI connect('my1st','iv',...) failed: Total Environment
allocation failure!  Did you set up your DB2 client environment?"

i've searched the web and have carefully done what is suggested: set
enviromental variables in an apache config file, in the way like this: 

PerlSetEnv DB2_PATH /opt/IBM/db2/
PerlPassEnv DB2_PATH

(i've also tried it with mod_env module and directives 
SetEnv && PassEnv)

my module can see these variables appropriately in %ENV:

CUR_INSTNAME - db2inst1
DB2DIR - /opt/IBM/db2/V8.1
DB2INSTANCE - db2inst1
DB2_PATH - /opt/IBM/db2/V8.1
INSTHOME - /home/db2inst1
LD_LIBRARY_PATH - /home/db2inst1/sqllib/lib
LIBPATH - /home/db2inst1/sqllib/lib
SQLLIB - /home/db2inst1/sqllib/lib

(i've listed them simply running "foreach my $key (sort keys %ENV) {
$r->print("$key - $ENV{$key}<br/>");}" )

but it doesn't help: still no connection and the same error

any ideas will be highly appreciated
iv


Re: connection to ibm db2 database

Posted by Helmut Zeilinger <hz...@hzlabs.de>.
Hi iv,

may be Stas' Env::C module helps - see

http://perl.apache.org/docs/2.0/user/troubleshooting/troubleshooting.html

and the modules manpage.

For example i set the relevant environment variables to connect
to an informix DB server in startup.pl: 

..
use Env::C;

Env::C::setenv('INFORMIXDIR', '/opt/informix', [$override]);
Env::C::setenv('INFORMIXSERVER', 'ol_server1', [$override]);
..



Helmut


iv schrieb:
> hello
>
> i've got a problem with connection to my database - db2.
>
> i'm trying to esteblish it from a mod_perl module; every time i get an
> error "null: DBI connect('my1st','iv',...) failed: Total Environment
> allocation failure!  Did you set up your DB2 client environment?"
>
> i've searched the web and have carefully done what is suggested: set
> enviromental variables in an apache config file, in the way like this: 
>
> PerlSetEnv DB2_PATH /opt/IBM/db2/
> PerlPassEnv DB2_PATH
>
> (i've also tried it with mod_env module and directives 
> SetEnv && PassEnv)
>
> my module can see these variables appropriately in %ENV:
>
> CUR_INSTNAME - db2inst1
> DB2DIR - /opt/IBM/db2/V8.1
> DB2INSTANCE - db2inst1
> DB2_PATH - /opt/IBM/db2/V8.1
> INSTHOME - /home/db2inst1
> LD_LIBRARY_PATH - /home/db2inst1/sqllib/lib
> LIBPATH - /home/db2inst1/sqllib/lib
> SQLLIB - /home/db2inst1/sqllib/lib
>
> (i've listed them simply running "foreach my $key (sort keys %ENV) {
> $r->print("$key - $ENV{$key}<br/>");}" )
>
> but it doesn't help: still no connection and the same error
>
> any ideas will be highly appreciated
> iv
>
>