Code example for Connection

Methods: close, isClosed

0
 
    /** 
     * @throws SQLException 
     */ 
    public void disconnect() throws SQLException { 
        connection.close();
        log.debug("Disconnected from database");
    } 
 
    /** 
     * @throws Throwable 
     */ 
    protected void finalize() throws Throwable { 
        try { 
            if (!connection.isClosed()) {
                disconnect(); 
            } 
 
        } catch (SQLException e) {
            log.error("Error while disconnecting from database");
            throw new SQLException("Error while disconnecting from database");