{"record":{"id":"9509be987e3c6d34","repo":"hibernate/hibernate-orm","slug":"cannot-close-a-connection-as-the-driver-manager-is","errorCode":null,"errorMessage":"Cannot close a connection as the driver manager is not properly initialized","messagePattern":"Cannot close a connection as the driver manager is not properly initialized","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DriverManagerConnectionProvider.java","lineNumber":296,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\n\n\t// use the pool ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\t@Override\n\tpublic Connection getConnection() throws SQLException {\n\t\tif ( state == null ) {\n\t\t\tthrow new IllegalStateException( \"Cannot get a connection as the driver manager is not properly initialized\" );\n\t\t}\n\t\treturn state.getConnection();\n\t}\n\n\t@Override\n\tpublic void closeConnection(Connection connection) throws SQLException {\n\t\tif ( state == null ) {\n\t\t\tthrow new IllegalStateException( \"Cannot close a connection as the driver manager is not properly initialized\" );\n\t\t}\n\t\tstate.closeConnection( connection );\n\t}\n\n\t@Override\n\tpublic boolean supportsAggressiveRelease() {\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic DatabaseConnectionInfo getDatabaseConnectionInfo(Dialect dialect) {\n\t\treturn new DatabaseConnectionInfoImpl(\n\t\t\t\tDriverManagerConnectionProvider.class,\n\t\t\t\tdbInfo.getJdbcUrl(),\n\t\t\t\tdbInfo.getJdbcDriver(),\n\t\t\t\tdialect.getClass(),\n\t\t\t\tdialect.getVersion(),\n\t\t\t\tdbInfo.hasSchema(),","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DriverManagerConnectionProvider.java#L278-L314","documentation":"Error \"Cannot close a connection as the driver manager is not properly initialized\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DriverManagerConnectionProvider.java:296 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not close connections after the provider has been stopped","Initialize the provider with proper JDBC settings before use"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}