https://bz.apache.org/bugzilla/show_bug.cgi?id=70011

            Bug ID: 70011
           Summary: org.apache.tomcat.jdbc.pool.ProxyConnection does not
                    honour java.sql.Wrapper
           Product: Tomcat Modules
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: jdbc-pool
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

In some JDBC drivers, the Connection may be double wrapped. Example:

For postgresql there is a PGConnection object which is typically wrapped as
follows:

    org.apache.tomcat.jdbc.pool.ProxyConnection unwrap(PGConnection.class) ->
        org.postgresql.jdbc.PGConnection

However, there are drivers that add additional features which wraps the
PGConnection like this (in the case of the aws advanced jdbc driver)

    org.apache.tomcat.jdbc.pool.ProxyConnection unwrap(ConnectionWrapper.class)
->
        software.amazon.jdbc.wrapper.ConnectionWrapper
unwrap(PGConnection.class) ->
            org.postgresql.jdbc.PGConnection

When libraries that consume the ProxyConnection.class calls it's unwrap method,
it is reasonable to expect it follow the specification of the Wrapper
interface:

    https://docs.oracle.com/javase/8/docs/api/java/sql/Wrapper.html

Which states:

    return the the result of calling unwrap recursively on the wrapped object
or a proxy for that result

However ProxyConnection does not do this, and so this creates a bug in the case
of the AWS Advanced JDBC driver and an exeption that states:

    java.sql.SQLException: Not a wrapper of org.postgresql.PGConnection

-- 
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]

Reply via email to