DBI error checking not working
From: patrickg (pat_at_patmail.com)
Date: 02/11/05
- Previous message: Mark D Andrews: "RE: finding and inserting"
- Next in thread: Mladen Gogala: "Re: DBI error checking not working"
- Reply: Mladen Gogala: "Re: DBI error checking not working"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 11 Feb 2005 16:39:29 GMT
Hey all - new to Perl and DBI, so just trying to get an understanding of
things. I copied some sample code from the Perl DBI book in the error
checking section, but I can't seem to get any of the error messages that I
expect. Instead, the program crashes and I get the popup box stating " Perl
Command Line Interpreter has encountered a problem and needs to close.". Can
someone tell me why none of these error messages are are being displayed
when I deliberately make a typo (ie. bad password, malformed SQL, etc) to
cause an error? (I've tried all the combinations of setting the PrintError
and RaiseError).
use strict;
use DBI;
my $dbh = DBI->connect( 'dbi:Oracle:orcl',
'scott',
'tiger',
{ RaiseError => 0,
PrintError => 0}
)|| die "Database connection not made: $DBI::errstr";
my $sth;
my $sql;
my ($obj1, $obj2);
$sql = qq{SELECT table_name, column_name
FROM user_tab_cols};
$sth = $dbh->prepare($sql) or die "Can't prepare: ", $dbh->errstr;
$sth->execute() or die "Can't execute: ", $dbh->errstr;
$sth->bind_columns( undef, \$obj1, \$obj2 );
while( $sth->fetch() ) {
print "$obj1\t$obj2\n";
}
$sth->finish();
TIA!
patrick
- Previous message: Mark D Andrews: "RE: finding and inserting"
- Next in thread: Mladen Gogala: "Re: DBI error checking not working"
- Reply: Mladen Gogala: "Re: DBI error checking not working"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|