I am attaching a patch for the test jdbcapi/characterStreams.java,
which fails in J2ME with the following error:
ERROR X0X95: Operation 'DROP INDEX' cannot be performed on object
'SQL051115082553360' because there is an open ResultSet dependent on
that object.
at
org.apache.derby.iapi.error.StandardException.newException(StandardException.java:322)
at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.verifyNoOpenResultSets(GenericLanguageConnectionContext.java:1696)
at
org.apache.derby.impl.sql.GenericPreparedStatement.prepareToInvalidate(GenericPreparedStatement.java:712)
at
org.apache.derby.impl.sql.depend.BasicDependencyManager.coreInvalidateFor(BasicDependencyManager.java:379)
at
org.apache.derby.impl.sql.depend.BasicDependencyManager.invalidateFor(BasicDependencyManager.java:224)
at
org.apache.derby.impl.sql.execute.DropIndexConstantAction.dropIndex(DropIndexConstantAction.java:214)
at
org.apache.derby.impl.sql.execute.DropConstraintConstantAction.dropConstraintAndIndex(DropConstraintConstantAction.java:316)
at
org.apache.derby.impl.sql.execute.DropTableConstantAction.dropAllConstraintDescriptors(DropTableConstantAction.java:346)
at
org.apache.derby.impl.sql.execute.DropTableConstantAction.executeConstantAction(DropTableConstantAction.java:219)
at
org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:56)
at
org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:368)
at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1142)
at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:550)
at
org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(EmbedStatement.java:158)
at
org.apache.derbyTesting.functionTests.tests.jdbcapi.characterStreams.main(characterStreams.java:68)
The patch adds a line to close the result set before exiting
'setStreams' method. With the patch, I ran this test successfully with
Sun JDK 1.4.2 (all 3 frameworks) and j9_foundation in IBM WCTME 5.7.
I was trying to see why this test was working in J2SE without the
rs.close(). I am thinking this is because the result set object gets
garbage collected and automatically closed when the method
'setStreams' exits. But in J2ME, garbage collection does not occur
immediately, hence a result set object remains open and drop operation
fails. It would be great if someone can take a look and commit this
patch.
Thanks,
Deepa
Index: java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/characterStreams.java
===================================================================
--- java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/characterStreams.java (revision 344298)
+++ java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/characterStreams.java (working copy)
@@ -222,6 +222,8 @@
checkCharacterStreams(psDel, psi, psq2, 25, 19332, 18733,colType);
checkCharacterStreams(psDel, psi, psq2, 1, 32433, 32673,colType);
checkCharacterStreams(psDel, psi, psq2, 0, 32532, 32700,colType);
+
+ rs.close();
}
private static int getMaxId(Connection conn) throws SQLException {