On a related note, when a result set contains a CLOB, when doing a
rs.last()/rs.first(), and then calling rs.next(), we get a "Container has
been closed." SQL exception.
Sample class:
----------------------------------------------------------------------------------------------
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class testZ {
private static String dbURL =
"jdbc:derby://9.42.11.34:1088/TestDB;create=true;user=test;password=derbypass";
public static void main(String[] args) {
try {
Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
Connection conn = DriverManager.getConnection(dbURL);
Statement stmt =
conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY);
//GROUPASC is column with CLOBS
ResultSet rs = stmt.executeQuery("select GROUPASC from
RE_EVENTGROUPASC
where EVENTID=5 OR EVENTID=6");
//ResultSet rs = stmt.executeQuery("select EVENTID from
RELATEDEVENTS.RE_EVENTGROUPASC where EVENTID=29419 OR EVENTID=29420");
rs.last();
rs.first();
if (!rs.next()) {
//exception here
}
rs.close();
stmt.close();
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
----------------------------------------------------------------------------------------------
Note there are two queries (one is commented out). The GROUPASC is the
column with the CLOB data type. When I call the second one (without the CLOB
column), it works fine. Only happens with CLOBs!
java.sql.SQLTransactionRollbackException: Container has been closed.
at
org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown
Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown
Source)
at org.apache.derby.client.am.ClientResultSet.next(Unknown Source)
at testZ.main(testZ.java:23)
Caused by: ERROR 40XD0: Container has been closed.
at org.apache.derby.client.am.ClientResultSet.completeSqlca(Unknown
Source)
at org.apache.derby.client.net.NetResultSetReply.parseFetchError(Unknown
Source)
at
org.apache.derby.client.net.NetResultSetReply.parseCNTQRYreply(Unknown
Source)
at
org.apache.derby.client.net.NetResultSetReply.readScrollableFetch(Unknown
Source)
at
org.apache.derby.client.net.ResultSetReply.readScrollableFetch(Unknown
Source)
at org.apache.derby.client.net.NetResultSet.readScrollableFetch_(Unknown
Source)
at org.apache.derby.client.am.ClientResultSet.flowGetRowset(Unknown
Source)
at org.apache.derby.client.am.ClientResultSet.getNextRowset(Unknown
Source)
at org.apache.derby.client.am.ClientResultSet.nextX(Unknown Source)
... 2 more
Are these bugs or something I am misunderstanding about CLOBs and Derby? I
don't hit these in other relational databases like DB2. Thanks again!
--
View this message in context:
http://apache-database.10148.n7.nabble.com/CLOB-data-errors-after-moving-cursor-around-tp142101p142103.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.