In UCP PreparedStatement equals() Method Is Not Working
(Doc ID 1158216.1)
Last updated on MARCH 01, 2021
Applies to:JDBC - Version 126.96.36.199 to 188.8.131.52 [Release 11.1]
Universal Connection Pool - Version 184.108.40.206.0 and later
Information in this document applies to any platform.
Currently, if a PreparedStatement or Statement is created from a connection that was obtained from a UCP DataSource, if you insert it as a key to a ConcurrentHashMap you will not be able to retrieve it via the same key, which is itself. If you additionally just try to do something like:
PreparedStatement pstmt = conn.prepareStatement("select <COLUMN> from <TABLE>");
will result in false which is not correct.
This would seem that the equals method has not been properly accounted for perhaps when used by a Proxy, which is what UCP uses.
If the connection was established via the DriverManager for example, if you do the same equals condition, it returns true, which is correct and that ultimately is using the same wrapper class.
Here is a sample code for this test:
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document