[EMAIL PROTECTED] writes:

> I worte a perl cgi script invoking Perl DBI to
> query a few tables and display values on
> a web browser and I am receving this error
> message. Any help?
> 
> The error was: DBI->connect(sample) failed: Total Environment allocation
> failure! Did you set up your DB2 client environment? at testdisplay.pl
> line 20

You should use something like:

# ---------------------------------------------------------------------------
# setup database connection
sub db_connect {
    my ( $self, $runmode ) = @_;
    return 1 if( defined($self->{'DBH'}) );
    my $dsn = $self->param( 'DBI_SOURCE' );
    my $user = $self->param( 'DBI_USER' );
    my $pswd = $self->param( 'DBI_PASSWD' );

    $ENV{"LANG"}        = "ru_RU";
    $ENV{'DB2CODEPAGE'} = '915';
    $ENV{'DB2INSTANCE'} = 'db2inst1';
    $self->{'DBH'} = DBI->connect( $dsn, $user, $pswd,
                                   { PrintError => 0,
                                     RaiseError => 1,
                                     AutoCommit => 0 } )
        || croak( "Database connection could not be established: ". DBI::errstr );
}

to connect to DB2 DBMS... It's a substract from my project built over the
CGI::Application + Apache::DBI

--
Max.

Reply via email to