Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Possible Bug in Informix JDBC Driver

Reply
Thread Tools

Possible Bug in Informix JDBC Driver

 
 
Zachi
Guest
Posts: n/a
 
      04-24-2007
Hi,

I'm using IBM's Informix JDBC driver 3.0JC3 (type 4 driver). I'm
seeing this weird behavior: If I'm setting a money (numeric/decimal)
field to NULL in a batch, it sometimes sets the field to the last non-
null value in the batch - or in a previous batch (that is, even with
batches of one insert I get non-null values when I'm supposed to get a
NULL). I am reading the nullls correctly from another ResultSet. If I
execute the command immediately, I do not see this effect. Here are
snippets of code to make this clearer:

ResultSet rs;
PreparedStatement p = ...("insert into ....values ?");

while (rs.hasNext()) {
...
p.setBigDecimal(i, rs.getBigDecimal(i));
...
p.addBatch();
}
p.submitBatch();

this will occasionally set wrong values for null. when I change this
to explicit setting of null:

BigDecimal b = rs.getBigDecimal(i);
if (rs.wasNull()) {
p.setNull(i, java.sql.Types.NUMERIC);
} else {
p.setBigDecimal(i, b);
}

it still get wrong results. If, however, I use p.execute() instead of
the batch it works fine.
any ideas?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [JDBC] JDBC Driver and timezones Lew Java 0 05-19-2010 03:33 PM
Possible Bug in Informix JDBC Driver with use of addBatch() with BigDecimal Zachi Java 5 04-28-2007 10:52 AM
Informix driver for Ruby Gerardo Santana Gómez Garrido Ruby 2 03-27-2006 10:09 AM
How to parse the jdbc driver name from the jdbc .jar file Bruce Java 4 03-25-2006 12:01 PM
oracle.jdbc.OracleDriver vs oracle.jdbc.driver.OracleDriver Betty Java 1 05-21-2005 05:15 PM



Advertisments