DBD::Informix - getting UDR errors
Posted in 2005
Topics: SQL Development & Query Writing, Stored Procedures & SPL, Error Codes & Troubleshooting, Server Administration, Platform-Specific Issues, Cloud, Docker & Containers
I am using DBD::Informix 2003.04 at work on an Informix database with the
Timeseries blade. I am using mainly 9.40.UC2 informix on Solaris and
Linux.
If I use dbaccess to run a query like this:
INSERT INTO test_table
VALUES ( 'mstok', 'mstok',
TSCreateIrr( 'gencal', '1999-01-01 00:00:00.00000',
0, 0, 0, 'xxxxxxxxxxxxxx '
)
);
Then I get an error message like
(UTSD2) - Container name: xxxxxxxxxxxxxx is too long. Max 18 bytes
Which is really helpful, and indicates that I have goofed up with
whitespace. When I put use that SQL in Perl and run this
my $sth = $dbh->prepare($SQL);
eval { $sth->execute(); };
if ($EVAL_ERROR) {
print "EVAL_ERROR = '$EVAL_ERROR'\\n";
print "handle error string = '", $sth->errstr, "'\\n";
print "DBI::errstr = '$DBI::errstr'\\n";
for my $attr (qw/ ix_sqlcode ix_sqlerrm ix_sqlerrp /) {
print "$attr = '", $sth->{$attr}, "'\\n";
}
for my $attr (qw/ ix_sqlerrd ix_sqlwarn /) {
print "$attr = ('", join( "', '", @{ $sth->{$attr} } ), "')\\n";
}
}
then I get a pretty unifirmative error message back:
$ ./try.pl
EVAL_ERROR = 'DBD::Informix::st execute failed: SQL: -937: User Defined
Routine error. at ./try.pl line 44.'
handle error string = 'SQL: -937: User Defined Routine error.'
DBI::errstr = 'SQL: -937: User Defined Routine error.'
ix_sqlcode = '-937'
ix_sqlerrm = ''
ix_sqlerrp = ''
ix_sqlerrd = ('1', '0', '0', '2', '226', '0')
ix_sqlwarn = (' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ')
(I know that some of those error codes make sense for cursor queries, I
have been trying *anything*)
Is there any way to get at the error message dbaccess can display from
DBD::Informix?
Thanks in advance,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA
| Fingerprint 0570 71CD 6790 7C28 3D60
| 75D2 9EC4 C1C0 0599 13DA
Mike Stok wrote:
> I am using DBD::Informix 2003.04 at work on an Informix database with the
> Timeseries blade. I am using mainly 9.40.UC2 informix on Solaris and
> Linux.
There is a v2005.01, but there's nothing in that to affect the
problematic behaviour. You'll need it if you upgrade to CSDK 2.90, though.
Please note that during the 'perl Makefile.PL' phase of building
DBD::Informix, there is a disclaimer:
Beware: DBD::Informix is not yet aware of all the new IUS data types.
That means, in particular, that it has not been tested with most of the
datablades. (I probably wrote that back in 1996 or 1997 - when IUS was
new; it is now, of course, IDS again. Hmmm...)
> If I use dbaccess to run a query like this:
>
> INSERT INTO test_table
> VALUES ( 'mstok', 'mstok',
> TSCreateIrr( 'gencal', '1999-01-01 00:00:00.00000',
> 0, 0, 0, 'xxxxxxxxxxxxxx '
> )
> );
Can you send me the schema for your test_table?
> Then I get an error message like
>
> (UTSD2) - Container name: xxxxxxxxxxxxxx is too long. Max 18 bytes
>
> Which is really helpful, and indicates that I have goofed up with
> whitespace. When I put use that SQL in Perl and run this
>
> my $sth = $dbh->prepare($SQL);
> eval { $sth->execute(); };
>
> if ($EVAL_ERROR) {
> print "EVAL_ERROR = '$EVAL_ERROR'\\n";
> print "handle error string = '", $sth->errstr, "'\\n";
> print "DBI::errstr = '$DBI::errstr'\\n";
> for my $attr (qw/ ix_sqlcode ix_sqlerrm ix_sqlerrp /) {
> print "$attr = '", $sth->{$attr}, "'\\n";
> }
> for my $attr (qw/ ix_sqlerrd ix_sqlwarn /) {
> print "$attr = ('", join( "', '", @{ $sth->{$attr} } ), "')\\n";
> }
> }
>
> then I get a pretty unifirmative error message back:
>
> $ ./try.pl
> EVAL_ERROR = 'DBD::Informix::st execute failed: SQL: -937: User Defined
> Routine error. at ./try.pl line 44.> '
> handle error string = 'SQL: -937: User Defined Routine error.'
> DBI::errstr = 'SQL: -937: User Defined Routine error.'
> ix_sqlcode = '-937'
> ix_sqlerrm = ''
> ix_sqlerrp = ''
> ix_sqlerrd = ('1', '0', '0', '2', '226', '0')
> ix_sqlwarn = (' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ')
>
> (I know that some of those error codes make sense for cursor queries, I
> have been trying *anything*)
>
> Is there any way to get at the error message dbaccess can display from
> DBD::Informix?
Dunno is the short and accurate answer.
I'll try and find out, but don't hold your breath. Ideally, you'd find
that this was an issue that you could investigate and then produce a
workable alternative way of handling this. Somehow, I have my doubts
that it is all that easy.
Any chance of sending me the try.pl script too?
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2005.01 -- http://dbi.perl.org/