I have a CLOB field in a derby table. After a simple SQL SELECT I try to convert CLOBs into Strings.
- DBConnection autocommit is off
- DBConnection is open
- This code fails although I never call the free() method:
dbCon.connect;
dbSourceDataList = dbCon.executeQuery(getSql());
// convert all CLOBs to Strings
for (int i = 0; i < dbSourceDataList.size(); i++) {
Object[] arr = dbSourceDataList.get(i);
for (int j = 0; j < arr.length; j++) {
if (arr[j] instanceof Clob) {
Clob clob = (Clob) arr[j];
arr[j] = clob.getSubString(1, (int) clob.length());
}
}
}
No java.sql.Clob/java.sql.Blob methods can be called after free() method has been called or a blob/clob transactions has been commited or rollbacked.
Convert CLOBs to Strings using directly the getClob() method of the java.sql.ResultSet: