Closed bickelj closed 9 months ago
Copying from an offhand comment in another issue:
I think there is an issue around https://github.com/swaldman/c3p0/blob/c3p0-0.9.5.3/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java#L1142 and https://github.com/swaldman/c3p0/blob/c3p0-0.9.5.3/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java#L1143 regarding the contract of isWrapperFor and unwrap.
The isWrapperFor method generated should follow the guidelines at https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/Wrapper.html#isWrapperFor(java.lang.Class) by calling isWrapperFor on the inner object. The c3p0 method unwrap also seems to call isWrapperFor around https://github.com/swaldman/c3p0/blob/c3p0-0.9.5.3/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java#L1158 which is why unwrap might not work in some cases.
The case I ran into was trying to run log4jdbc under c3p0 and the pg jdbc driver under that, and isWrapperFor returned false. Not sure if this is exactly the same cause of your issue, but might be worth trying out.
:tada:
Copying from an offhand comment in another issue:
I think there is an issue around https://github.com/swaldman/c3p0/blob/c3p0-0.9.5.3/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java#L1142 and https://github.com/swaldman/c3p0/blob/c3p0-0.9.5.3/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java#L1143 regarding the contract of isWrapperFor and unwrap.
The isWrapperFor method generated should follow the guidelines at https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/Wrapper.html#isWrapperFor(java.lang.Class) by calling isWrapperFor on the inner object. The c3p0 method unwrap also seems to call isWrapperFor around https://github.com/swaldman/c3p0/blob/c3p0-0.9.5.3/src/java/com/mchange/v2/c3p0/codegen/JdbcProxyGenerator.java#L1158 which is why unwrap might not work in some cases.
The case I ran into was trying to run log4jdbc under c3p0 and the pg jdbc driver under that, and isWrapperFor returned false. Not sure if this is exactly the same cause of your issue, but might be worth trying out.