Code example for Connection

Methods: close, createStatement, isClosed

0
 
    @Override 
    public void tearDown() { 
        Statement st = null;
        try { 
            if (! conn.isClosed()) {
                st = conn.createStatement();
                st.execute("drop table if exists zoo");
            } 
        } catch (SQLException e) {
            fail("Couldn't drop table: " + e.getMessage());
        } finally { 
            try { 
                if (st != null) {
                    st.close();
                    conn.close();
                } 
            } catch(SQLException ee) {
                //ignore 
            } 
        }