Code example for Connection

Methods: getAutoCommit, setAutoCommit, setTransactionIsolation

0
 
	private static final Log log = LogFactory.getLog(C3P0ConnectionProvider.class);
 
	public Connection getConnection() throws SQLException {
		final Connection c = ds.getConnection();
		if (isolation!=null) c.setTransactionIsolation( isolation.intValue() );
		if ( c.getAutoCommit()!=autocommit ) c.setAutoCommit(autocommit);
		return c;
	} 
 
	public void closeConnection(Connection conn) throws SQLException {
		conn.close();
	} 
 
	public void configure(Properties props) throws HibernateException {
		String jdbcDriverClass = props.getProperty(Environment.DRIVER);
		String jdbcUrl = props.getProperty(Environment.URL);
		Properties connectionProps = ConnectionProviderFactory.getConnectionProperties(props);
 
		log.info( "C3P0 using driver: " + jdbcDriverClass + " at URL: " + jdbcUrl );
		log.info( "Connection properties: " + PropertiesHelper.maskOut(connectionProps, "password") );