https://bz.apache.org/bugzilla/show_bug.cgi?id=60099
Bug ID: 60099
Summary: StatementCache does not check the scrollable type of
result set when searching for a cached statement
Product: Tomcat Modules
Version: unspecified
Hardware: PC
Status: NEW
Severity: major
Priority: P2
Component: jdbc-pool
Assignee: [email protected]
Reporter: [email protected]
Created attachment 34224
--> https://bz.apache.org/bugzilla/attachment.cgi?id=34224&action=edit
Test class
When the StatementCache is searching for a matching PreparedStatement, the
matching criteria do not take into account the scrollable type of result set,
but only the sql query.
If we create a PreparedStatement with a FORWARD_ONLY result set type, and then
we try to create another PreparedStatement with a SCROLL_INSENSITIVE type with
the same query, then the cache will return the PreparedStatement created
first(a FORWARD_ONLY statement), and any attempt to call the absolute method
will throw a java.sql.SQLException: The 'absolute()' method is only allowed on
scroll cursors.
Please find attached a Test Class that can help to reproduce the problem. To
run this class you need to add derby-10.11, tomcat-jdbc-8.0.37 and
tomcat-juli-8.0.37 to classpath. I am using jdk1.8.0_92 to compile and execute
this test.
P.S. The error only appears when creating a PreparedStatement instead of a
Statement (by calling createStatement()).
Please tell me, if you need more informations.
Thanks for your help!
Full StackTrace:
Exception in thread "main" java.sql.SQLException: The 'absolute()' method is
only allowed on scroll cursors.
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedResultSet.checkScrollCursor(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedResultSet.absolute(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor$ResultSetProxy.invoke(StatementDecoratorInterceptor.java:307)
at com.sun.proxy.$Proxy4.absolute(Unknown Source)
at test.Test.testWithInsensitiveResultSet(Test.java:75)
at test.Test.main(Test.java:18)
Caused by: ERROR XJ061: The 'absolute()' method is only allowed on scroll
cursors.
at org.apache.derby.iapi.error.StandardException.newException(Unknown
Source)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown
Source)
... 14 more
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]