brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.87k stars 2.92k forks source link

warning + stack trace logged at startup when using the embedded Derby driver with Hibernate #2075

Open dmngb opened 1 year ago

dmngb commented 1 year ago

When using Hibernate + Hikari + Derby Embedded driver, we get the following scary warning in the logs at init:

2023-05-23T12:03:09.677+02:00  WARN 9796 --- [  restartedMain] com.zaxxer.hikari.pool.ProxyConnection   : HikariPool-1 - Connection org.apache.derby.impl.jdbc.EmbedConnection@1991538780 (XID = 340), (SESSIONID = 3), (DATABASE = directory:mxtp), (DRDAID = null)  marked as broken because of SQLSTATE(0A000), ErrorCode(20000)

java.sql.SQLFeatureNotSupportedException: Feature not implemented: No details.
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:106)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:225)
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:220)
    at org.apache.derby.impl.jdbc.Util.notImplemented(Util.java:289)
    at org.apache.derby.impl.jdbc.Util.notImplemented(Util.java:285)
    at org.apache.derby.impl.jdbc.EmbedConnection.createNClob(EmbedConnection.java:3728)
    at com.zaxxer.hikari.pool.HikariProxyConnection.createNClob(HikariProxyConnection.java)
    at org.hibernate.engine.jdbc.env.internal.LobCreationHelper.canCreateNClob(LobCreationHelper.java:104)
.....

Hibernate checks at runtime if NClob is supported:

    private static boolean canCreateNClob(Connection jdbcConnection) {
        try {
            // we just want to see if the driver can create one.  we can immediately free it.
            final Clob clob = jdbcConnection.createNClob();
            try {
                clob.free();
            }
            catch (Throwable e) {
                LOB_LOGGER.tracef( "Unable to free NCLOB created to test createNClob() implementation : %s", e );
            }
            return true;
        }
        catch (SQLException e) {
            LOB_MESSAGE_LOGGER.contextualNClobCreationFailed( e );
            return false;
        }
    }

Would it be possible to change the logging behavior on SQLFeatureNotSupportedException ?

See https://github.com/spring-projects/spring-boot/issues/35599

kai83 commented 7 months ago

I saw this today as well. Looks like this is not fixed yet. Any plans to fix it or does it have a special reason the Stacktrace is outputtet?

piyumiradeeshani commented 7 months ago

I also got this exception with newer version too. Unfortunately it doesn't seem good when we get this error while building the project :( Any plans to fix it?

Screenshot 2024-02-21 at 12 23 22 am
emilianmanoleuni commented 2 months ago

I have the same problem, is there any solution? A possible solution could be a temporarly downgrade but at what version?

felipesoares-tech commented 2 months ago

I have the same problem

aalbaiaa commented 1 month ago

I have the same problem, what derby version you have? my version is 10.16.1.1

diperpiracoca commented 1 month ago

I have the same problem, is there any progress or way to remove the warning?