hibernate/hibernate-orm · error · IllegalStateException

Cannot close a connection as the driver manager is not prope

Error message

Cannot close a connection as the driver manager is not properly initialized

What it means

Error "Cannot close a connection as the driver manager is not properly initialized" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DriverManagerConnectionProvider.java:296

			}
		}
	}


	// use the pool ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	@Override
	public Connection getConnection() throws SQLException {
		if ( state == null ) {
			throw new IllegalStateException( "Cannot get a connection as the driver manager is not properly initialized" );
		}
		return state.getConnection();
	}

	@Override
	public void closeConnection(Connection connection) throws SQLException {
		if ( state == null ) {
			throw new IllegalStateException( "Cannot close a connection as the driver manager is not properly initialized" );
		}
		state.closeConnection( connection );
	}

	@Override
	public boolean supportsAggressiveRelease() {
		return false;
	}

	@Override
	public DatabaseConnectionInfo getDatabaseConnectionInfo(Dialect dialect) {
		return new DatabaseConnectionInfoImpl(
				DriverManagerConnectionProvider.class,
				dbInfo.getJdbcUrl(),
				dbInfo.getJdbcDriver(),
				dialect.getClass(),
				dialect.getVersion(),
				dbInfo.hasSchema(),

View on GitHub (pinned to fad1729dce)

Solutions

  1. Do not close connections after the provider has been stopped
  2. Initialize the provider with proper JDBC settings before use

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/engine/jdbc/connections/internal/DriverManagerConnectionProvider.java:296 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/9509be987e3c6d34. Report an issue: GitHub.