All,
I've got the following code, in a Java program I'm running from QShell
try {
Statement stmt = sqlConn.createStatement();
ResultSet rs = stmt.executeQuery("select select varchar05,
intfld, varchar02 " +
" from
CINTAS.cadmin.sometable");
PreparedStatement ps = i5Conn.prepareStatement("INSERT INTO
CINTASDTA.INACTCAB VALUES(?,?,?)");
while (rs.next()) {
ps.setString(1,rs.getString(1));
ps.setLong(2,rs.getLong(2));
ps.setString(3,rs.getString(3));
ps.addBatch();
}
ps.executeBatch();
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
When the "use block insert" property is set to true, it fails with a
message:
"Error occurred in SQL Call Level Interface - HY009 "
There's a job log created which has the following:
SQ99999 Diagnostic 30 12/16/08 08:53:35.935112
QSQCLI QSYS *STMT QJVAJDBC QS
From module . . . . . . . . :
SQLPO
From procedure . . . . . . :
SQLParamOptions
Statement . . . . . . . . . :
4742
To module . . . . . . . . . :
QJVACLII
To procedure . . . . . . . :
JDBCParamOptions
Statement . . . . . . . . . :
4
Message . . . . : Error occurred in
SQL Call Level Interface
Cause . . . . . : A procedure call
encountered an error. The error code is
9. Error codes are: 3 -- Program type
out of range. 4 -- SQL data type out
of range. 9 -- Argument value not
valid. 10 -- Function sequence error. 12
If I change "use block insert" to FALSE, it works fine.
Also, I can leave "use block insert" to TRUE and have it work if instead of
batching the inserts, I do them one at a time:
try {
Statement stmt = sqlConn.createStatement();
ResultSet rs = stmt.executeQuery("select varchar05, intfld,
varchar02 " +
" from
CINTAS.cadmin.sometable");
PreparedStatement ps = i5Conn.prepareStatement("INSERT INTO
CINTASDTA.INACTCAB VALUES(?,?,?)");
while (rs.next()) {
ps.setString(1,rs.getString(1));
ps.setLong(2,rs.getLong(2));
ps.setString(3,rs.getString(3));
ps.executeUpdate();
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
}
But I think when the inserts are not batched they are not blocked either...
Does anybody know what I'm doing wrong?
There's just over 44,000 rows being inserted, perhaps that's to many for one
batch?
Thanks!
Charles Wilt