Skip to Content

MaxDB issue when updating via ResultSet.updateRow()


We are currently in the process of updating LONG columns from ASCII to UNICODE, and since this cannot be done natively in the DB, we are doing it using an updatable ResultSet. While doing so we have encountered a strange behavior with MaxDB (via JDBC) using ResultSet.updateRow().

Here is the pseudo code:

String sql = "select col_ascii, col_unicode from unicode_conversion_test";

try (
  Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
  ResultSet rs = stmt.executeQuery(sql)) {
    while( {
      rs.updateString(2, rs.getString(1));

      boolean assertOk = Objects.equals(rs.getString(1),rs.getString(2));

When executing this code snippet on 900k rows, it resulted in 0.1% of the data not correctly copied! From the content, it seems the result set is copying values from a nearby row.

1) assertOk is sometimes false, so this is reproducible

2) we tried with forward only type, and at a later time check all the rows. However it yield the same result..

3) Also tried with Scroll Insensitive, same result.

4) There were no exceptions or db errors, only a consistency check showed the problem!

Our current workaround is to use a prepared statement and use that to update the columns, however this way does not work for tables without a primary key..

Is there something we are missing/doing wrong or is this a known bug/issue?

Thank you,


Following are the version info, taken from DatabaseMetaData:

Database: SAP DB KERNEL 7.9.09 BUILD 001-123-257-024 (7.9)

JDBC Driver: SAP DB package, MaxDB JDBC Driver, SAP AG, 7.6.10 Build 000-000-011-336 (Make-Version: 7.9.09 Build 007-123-261-455)

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers