Skeeve has asked for the wisdom of the Perl Monks concerning the following question:
I have this code, which fails to report an error when I deliberately use a non existing database tabel:
use DBI; # Load the DBI module ### Perform the connection using the Oracle driver my $dbh = DBI->connect( "dbi:mysql:MYDB:localhost:3306", "NYUSER", "MY +PASS", { PrintError => 0, RaiseError => 0 } ) or die "Can't connect to the database: $DBI::errstr\n"; ### Prepare a SQL statement for execution my $sth = $dbh->prepare( "UPDATE user_settingsX set `language`=? WHERE + `username` = ?" ) or die "Can't prepare SQL statement: $DBI::errstr\n"; ### Execute the statement in the database $sth->execute("fr", "admin") or die "Can't execute SQL statement: ",$sth->errstr,"\n"; ## I also tried: "Can't execute SQL statement: $DBI::errstr\n"; ### Disconnect from the database $dbh->disconnect or warn "Error disconnecting: $DBI::errstr\n"; exit;
I would expect the an error message telling me that the tabel "user_settingsX" does not exist, but the errstr is undef.
I'm using:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD::mysql does not return errorstring
by Skeeve (Parson) on May 12, 2014 at 10:21 UTC | |
|
Re: DBD::mysql does not return errorstring
by leslie (Pilgrim) on May 12, 2014 at 11:10 UTC | |
by Skeeve (Parson) on May 12, 2014 at 12:32 UTC |