{"record":{"id":"92c1737b4c6beba2","repo":"alibaba/druid","slug":"error-92c173","errorCode":null,"errorMessage":"Error","messagePattern":"Error","errorType":"exception","errorClass":"SQLException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java","lineNumber":131,"sourceCode":"\n    public SQLException handleException(Throwable t) throws SQLException {\n        return handleException(t, null);\n    }\n\n    public SQLException handleException(Throwable t, String sql) throws SQLException {\n        final DruidConnectionHolder holder = this.holder;\n\n        //\n        if (holder != null) {\n            DruidAbstractDataSource dataSource = holder.getDataSource();\n            dataSource.handleConnectionException(this, t, sql);\n        }\n\n        if (t instanceof SQLException) {\n            throw (SQLException) t;\n        }\n\n        throw new SQLException(\"Error\", t);\n    }\n\n    public boolean isOracle() {\n        return holder.getDataSource().isOracle();\n    }\n\n    public void closePoolableStatement(DruidPooledPreparedStatement stmt) throws SQLException {\n        PreparedStatement rawStatement = stmt.stmt;\n\n        final DruidConnectionHolder holder = this.holder;\n        if (holder == null) {\n            return;\n        }\n\n        if (stmt.pooled) {\n            try {\n                rawStatement.clearParameters();\n            } catch (SQLException ex) {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/alibaba/druid/blob/fa8dc9912637a2f729eef9f55356621fec18d40e/core/src/main/java/com/alibaba/druid/pool/DruidPooledConnection.java#L113-L149","documentation":"Thrown by DruidPooledConnection.handleException(Throwable, String sql) when the passed Throwable is not a SQLException. After delegating to the DataSource's handleConnectionException, if the throwable is not a SQLException it is wrapped in SQLException(\"Error\", t) so JDBC callers that only catch SQLException still receive it. Same wrapping rationale as error 45 but on the pooled-connection entry point.","triggerScenarios":"pooledConn.handleException(someError) where someError is e.g. a RuntimeException or java.lang.Error thrown by a custom statement interceptor, a driver bug, or a Filter. Line 131 wraps it.","commonSituations":"A Filter or statement proxy throwing a non-SQL exception that bubbles into handleException; OOM/StackOverflow during statement use; a third-party JDBC wrapper raising RuntimeExceptions; misbehaving driver raising Error on closed resources.","solutions":["Read getCause() for the original non-SQL Throwable and fix its root cause.","Make custom interceptors/Filters throw SQLException so they propagate as typed SQL failures.","Treat a non-SQLException here as a serious condition (often an Error) warranting request failure and logging at ERROR."],"exampleFix":"// before\npooledConn.handleException(new RuntimeException(\"driver bug\"));\n\n// after — wrap upstream failures in SQLException\npooledConn.handleException(new SQLException(\"driver bug\", runtimeEx));","handlingStrategy":"try-catch","validationCode":"if (!(t instanceof SQLException)) {\n    // wrap upstream so handleException sees a typed SQL exception\n    t = new SQLException(\"wrapped non-SQL failure\", t);\n}\npooledConn.handleException(t);","typeGuard":"boolean isSqlOrWrapped = (t instanceof SQLException)\n    || (t.getCause() instanceof SQLException);","tryCatchPattern":"try {\n    pooledConn.handleException(t);\n} catch (SQLException e) {\n    if (\"Error\".equals(e.getMessage()) && !(e.getCause() instanceof SQLException)) {\n        Throwable real = e.getCause();\n        log.error(\"non-SQL throwable in pooled connection\", real);\n        if (real instanceof Error) throw (Error) real;\n    }\n    throw e;\n}","preventionTips":["Wrap non-SQL Throwables in SQLException before passing to handleException.","Make custom Filters throw SQLException so they propagate cleanly.","Always inspect the cause of a generic SQLException(\"Error\")."],"tags":["exception-wrapping","non-sqlexception","filter","connection-pool","diagnostics"],"backgroundTag":null,"analyzedSha":"fa8dc9912637a2f729eef9f55356621fec18d40e","analyzedAt":"2026-08-14T04:55:06.789Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}