On June 1, 2004 1:47 pm, Alec Brecher wrote: > kind of an apache2 crossover problem: when perl cgi scripts using dbi:db2 > are called I get the total enviroment failure error. > > I can run scripts using dbi:db2 from the shell without a problem. Can > anyone offer some hints?
Set $ENV{DB2INSTANCE} in a BEGIN{} block, e.g.: BEGIN { $ENV{DB2INSTANCE} = 'db2inst1' } You may not need to do it in a BEGIN block, perhaps just doing it prior to calling DBI->connect, but I've always just done it in BEGIN.