HELP: DBD::Informix issues
Posted in 2003
Topics: Installation, Setup & Upgrades, Error Codes & Troubleshooting, Server Administration, Versions, Editions & End-of-Life
Hey guys,
I have the following issues with connecting to my DB using Perl. But first
some background:
I create my DB like:
CREATE DATABASE george_db_upp IN maindbs WITH BUFFERED LOG;I use DBD::Informix version 1.00.PC2
Running IDS 9.3:
Here's my script:
--------------------
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my
$oDBHandle=DBI->connect('DBI:Informix:george_db_upp@dbdev','gkarabot','',{Ra
iseError=>1,AutoCommit=>0});
print(STDERR "FIRST COMMIT\\n");
$oDBHandle->do('COMMIT WORK')||die($oDBHandle->errstr);
print(STDERR "SECOND COMMIT\\n");
$oDBHandle->do('COMMIT WORK')||die($oDBHandle->errstr);
print(STDERR "PREPARE STATEMENT\\n");
my $oSQLHandle=$oDBHandle->prepare('SELECT * from
asdfasdf')||die($oDBHandle->errstr);
$oDBHandle->disconnect();
------------------------
Here's the output from the server that only has the Informix client
installed:
(487)@tito/home/gkarabot/perl_tests > ./dbi_commit.pl
FIRST COMMIT
SECOND COMMIT
PREPARE STATEMENT
Use of uninitialized value in die at ./dbi_commit.pl line 15.
Died at ./dbi_commit.pl line 15.
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect().
Here's the output from the server that has the Informix DB, client, dbacces,
etc installed:
(173)@larcius/home/gkarabot/perl_tests > ./dbi_commit.pl
FIRST COMMIT
SECOND COMMIT
PREPARE STATEMENT
DBD::Informix::db prepare failed: SQL: -206: The specified table (asdfasdf)
is not in the database.
ISAM: -111: ISAM error: no record found. at ./dbi_commit.pl line 15.
DBD::Informix::db prepare failed: SQL: -206: The specified table (asdfasdf)
is not in the database.
ISAM: -111: ISAM error: no record found. at ./dbi_commit.pl line 15.
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect().
Basically I have two issues,
1) Why am I not getting error "-255 Not in transaction" error from the two
"COMMIT WORK" statements above?
2) Why when I run this script from tito, which has only the client
installed, I get an empty DBI->errstr value?
thank you in advance,
George
Douglas Wilson wrote: > On Mon, 2 Jun 2003 21:59:16 -0400, "George Karabotsos" <karabot@canada.com> > wrote: > >>1) Why am I not getting error "-255 Not in transaction" error from the two >>"COMMIT WORK" statements above? > > With DBI and AutoCommit set to zero, you are always in a transaction, and > after every commit there is an implicit BEGIN WORK. Correct - though internally to DBD::Informix, the BEGIN WORK is explicitly put there. >>2) Why when I run this script from tito, which has only the client >>installed, I get an empty DBI->errstr value? > > With RaiseError set to true, you will not execute those '|| die ...' statements, > because DBI will die before you get to them. Partly true, but DBD::Informix should have generated the error message which DBI should then emit - I think RaiseError=>1 implies that the error is printed too (to STDERR). This behaviour has me puzzled. > HTH, > Douglas Wilson -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
On Mon, 2 Jun 2003 21:59:16 -0400, "George Karabotsos" <karabot@canada.com> wrote: >1) Why am I not getting error "-255 Not in transaction" error from the two >"COMMIT WORK" statements above? With DBI and AutoCommit set to zero, you are always in a transaction, and after every commit there is an implicit BEGIN WORK. > >2) Why when I run this script from tito, which has only the client >installed, I get an empty DBI->errstr value? With RaiseError set to true, you will not execute those '|| die ...' statements, because DBI will die before you get to them. HTH, Douglas Wilson