/** * Physically opens a JDBC Connection. * * @throws org.hibernate.JDBCException Indicates problem opening a connection */ private void obtainConnection() throws JDBCException { LOG.debug( "Obtaining JDBC connection" ); try { physicalConnection = jdbcConnectionAccess.obtainConnection(); for ( ConnectionObserver observer : observers ) { observer.physicalConnectionObtained( physicalConnection ); } LOG.debug( "Obtained JDBC connection" ); } catch ( SQLException sqle) { throw getJdbcServices().getSqlExceptionHelper().convert( sqle, "Could not open connection" ); } }
if ( useJdbcMetadata ) { try { Connection connection = jdbcConnectionAccess.obtainConnection(); try { DatabaseMetaData meta = connection.getMetaData(); jdbcConnectionAccess.releaseConnection( connection );
/** * Physically closes the JDBC Connection. * * @throws JDBCException Indicates problem closing a connection */ private void releaseConnection() throws JDBCException { LOG.debug( "Releasing JDBC connection" ); if ( physicalConnection == null ) { return; } try { if ( !physicalConnection.isClosed() ) { getJdbcServices().getSqlExceptionHelper().logAndClearWarnings( physicalConnection ); } if ( !isUserSuppliedConnection ) { jdbcConnectionAccess.releaseConnection( physicalConnection ); } } catch (SQLException e) { throw getJdbcServices().getSqlExceptionHelper().convert( e, "Could not close connection" ); } finally { physicalConnection = null; } LOG.debug( "Released JDBC connection" ); for ( ConnectionObserver observer : observers ) { observer.physicalConnectionReleased(); } releaseNonDurableObservers(); }
if ( useJdbcMetadata ) { try { Connection connection = jdbcConnectionAccess.obtainConnection(); try { DatabaseMetaData meta = connection.getMetaData(); jdbcConnectionAccess.releaseConnection( connection );
/** * Physically closes the JDBC Connection. * * @throws JDBCException Indicates problem closing a connection */ private void releaseConnection() throws JDBCException { LOG.debug( "Releasing JDBC connection" ); if ( physicalConnection == null ) { return; } try { if ( !physicalConnection.isClosed() ) { getJdbcServices().getSqlExceptionHelper().logAndClearWarnings( physicalConnection ); } if ( !isUserSuppliedConnection ) { jdbcConnectionAccess.releaseConnection( physicalConnection ); } } catch (SQLException e) { throw getJdbcServices().getSqlExceptionHelper().convert( e, "Could not close connection" ); } finally { physicalConnection = null; } LOG.debug( "Released JDBC connection" ); for ( ConnectionObserver observer : observers ) { observer.physicalConnectionReleased(); } releaseNonDurableObservers(); }
/** * Physically opens a JDBC Connection. * * @throws org.hibernate.JDBCException Indicates problem opening a connection */ private void obtainConnection() throws JDBCException { LOG.debug( "Obtaining JDBC connection" ); try { physicalConnection = jdbcConnectionAccess.obtainConnection(); for ( ConnectionObserver observer : observers ) { observer.physicalConnectionObtained( physicalConnection ); } LOG.debug( "Obtained JDBC connection" ); } catch ( SQLException sqle) { throw getJdbcServices().getSqlExceptionHelper().convert( sqle, "Could not open connection" ); } }