AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Possible Bug in Informix JDBC Driver

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Zachi
Guest





PostPosted: Wed Apr 25, 2007 4:11 am    Post subject: Possible Bug in Informix JDBC Driver Reply with quote



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?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.