Hi, I'm working with: Solaris 7, latest DBI latest DBD::DB2 module and
DB2 v 6.1 and the Apache modified by IBM for the Websphere platform

after the usual pain compiling the db2 module and made it work,
everything went fine until the moment I tried to run scripts from the
web, I've read that in order to run scripts the db2 client must be set
up, running the db2profile script or setting the variables for DB2.

I created a little perl script that goes as follows:
--------------------
#!/usr/local/bin/perl
use DBI; use CGI qw(:all); $DBI::dbi_debug=9; $q = new CGI;
####################VARS#####
$ENV{LOGNAME}=qq|db2inst1|;
$ENV{ICU_DATA}=qq|/opt/WebSphere/CommerceSuite/bin/icu/data/|;
$ENV{TZ}=qq|Mexico/General|;
$ENV{ADVISOR_SERVER_HOME}=qq|/opt/WebSphere/CommerceSuite/AdvSvr|;
$ENV{LC_ALL}=qq|C|;
$ENV{PWD}=qq|/opt/IBMHTTPD/cgi-bin|;
$ENV{WEBS}=qq|/opt/IBMHTTPD/|;
$ENV{NLSPATH}=qq|/usr/lib/locale/%L/%N:/usr/lib/locale/%L/%N.cat:/usr/lib/locale

/%L/%N:/usr/lib/locale/%L/%N.cat|;
$ENV{HZ}=qq|100|;
$ENV{DB2COMM}=qq|TCPIP|;
$ENV{DB2INSTANCE}=qq|db2inst1|;
$ENV{DB2_HOME}=qq|/opt/IBMdb2/V6.1|;
$ENV{HOME}=qq|/opt/IBMHTTPD|;
$ENV{LD_LIBRARY_PATH}=qq|/opt/WebSphere/CommerceSuite/AdvSvr/lib:/export/home/db

2inst1/sqllib/lib:/usr/java/lib/sparc/green_threads:/opt/WebSphere/CommerceSuite

/bin::/export/home/db2inst1/sqllib/lib:/opt/IBMNetData/lib|;
$ENV{THREADS_TYPE}=qq|native_threads|;
$ENV{LIBPATH}=qq|/export/home/db2inst1/sqllib/odbclib.lib:|;
$ENV{THREADS_FLAG}=qq|native|;
$ENV{CLASSPATH}=qq|.:..:/opt/WebSphere/CommerceSuite/AdvSvr/lib:/opt/WebSphere/C

ommerceSuite/AdvSvr/lib/AdvisorSvr.jar:/opt/WebSphere/CommerceSuite/AdvSvr/lib/A

dvisor.jar:/opt/WebSphere/CommerceSuite/AdvSvr/lib/NdAdvisorCorba.jar:/opt/WebSp

here/CommerceSuite/AdvSvr/lib/AdvisorCOM.jar:/opt/WebSphere/CommerceSuite/AdvSvr

/lib/NdJdbc.jar:/opt/WebSphere/CommerceSuite/AdvSvr/lib/xml4j.jar::/export/home/

db2inst1/sqllib/java/db2java.zip:/export/home/db2inst1/sqllib/java/runtime.zip:.

:/usr/java/lib:/usr/java/lib/classes.zip:/export/home/db2inst1/sqllib/java/db2ja

va.zip|;
$ENV{PATH}=qq|/export/home/db2inst1/sqllib/bin:/export/home/db2inst1/sqllib/adm:

/export/home/db2inst1/sqllib/misc:/usr/bin/../java/bin/../bin:/opt/WebSphere/Com

merceSuite/AdvSvr/bin:/usr/bin::/usr/ccs/bin/make:/usr/local/bin:/export/home/db

2inst1/sqllib/bin:/export/home/db2inst1/sqllib/adm:/export/home/db2inst1/sqllib/

misc:/opt/WebSphere/CommerceSuite/bin|;
$ENV{JAVA_HOME}=qq|/usr/java|;
$ENV{LANG}=qq|en_US|;
####################VARS#####
print $q->header( -type=> "text/html");
print $q->start_html;
while ( ($var,$val) = each(%ENV)){
       print "\$ENV\{$var\}=qq|$val|;", $ENV{SERVER_PROTOCOL} ? "<br>" :
"\n";
}
$dbh = DBI->connect("dbi:DB2:mser","db2inst1","pass**") or die "No
connection";
my $sel = qq |select count(*) from db2inst1.category|;
my $sth = $dbh->prepare($sel);
$sth->execute();
 my $row=$sth->fetchrow_array();
      $sth->finish();
      $dbh->disconnect();
      print $row;
_end_

As you can see I've setup every single variable to connect, but still no
success, I'm still getting the message "Total Environment allocation
failure!  Did you set up
 your DB2 client environment?" at the Apache logs. What is missing? What
I'm left to do? Any hint or lead will be greatly appreciated.

bests


--
De duobus malis, minus est semper eligendum


Reply via email to