In UCP PreparedStatement equals() Method Is Not Working
(Doc ID 1158216.1)
Last updated on MARCH 15, 2022
Applies to:JDBC - Version 220.127.116.11 to 18.104.22.168 [Release 11.1]
Universal Connection Pool - Version 22.214.171.124.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