Hi,
I have a DB2 db as source and an Informix DB as target db.
I have something like this:
String sourceSql = "SELECT x FROM y";
ResultSet rs = ...;
Connection targetConn = ...;
PreparedStatement ps = null;
while(rs.next()) {
Long x = rs.getLong("x");
String targetSql = "INSERT INTO y (x) VALUES (?)";
ps = targetConn.prepareStatement(targetSql);
ps.setLong(1, x);
ps.executeUpdate();
ps.close();
}
targetConn.close();
rs.close();
The program breaks with an "com.ibm.db2.jcc.c.SqlException: [ibm][db2][jcc][10120][10898]".
I tried the createStatement for the DB2 db with different parameters for resultSetType and resultSetConcurrency, but no success. The number of lines inserted are dependent on the settings of the parameters. But it never finished. If I do no inserts, e.g. simple console outputs in the loop, it works. The weird thing is, it seems to be a timing problem, e.g. the number of lines successfully inserted depends on wether it runs in debug mode or not.