My Oracle Support Banner

In UCP PreparedStatement equals() Method Is Not Working (Doc ID 1158216.1)

Last updated on JUNE 05, 2023

Applies to:

JDBC - Version 11.1.0.7 to 11.1.0.7 [Release 11.1]
Universal Connection Pool - Version 11.1.0.7.0 and later
Information in this document applies to any platform.

Symptoms

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>");
pstmt.equals(pstmt)

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:




Changes

 

Cause

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
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.