Possible Bug in Informix JDBC Driver

Discussion in 'Java' started by Zachi, Apr 25, 2007.

  1. Zachi

    Zachi Guest

    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?
     
    Zachi, Apr 25, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Betty
    Replies:
    1
    Views:
    9,873
    Juha Laiho
    May 21, 2005
  2. Bruce
    Replies:
    4
    Views:
    759
    Bjorn Abelli
    Mar 25, 2006
  3. Zachi
    Replies:
    5
    Views:
    482
    Zachi
    Apr 28, 2007
  4. Lew
    Replies:
    0
    Views:
    520
  5. Gerardo Santana Gómez Garrido

    Informix driver for Ruby

    Gerardo Santana Gómez Garrido, Mar 2, 2006, in forum: Ruby
    Replies:
    2
    Views:
    280
    Gerardo Santana Gómez Garrido
    Mar 27, 2006
Loading...

Share This Page