public void close() {
   Connection con = getConnection();
   if (con != null) {
     try {
       con.close();
       setConnection(null);
     } catch (Exception e) {
       Debug.warning(e);
     }
   }
 }
 public boolean query(String sql) {
   try {
     Statement stmt = getStatement();
     if (stmt != null) stmt.close();
     ResultSet rs = getResultSet();
     if (rs != null) rs.close();
     Connection con = getConnection();
     if (con == null) return false;
     stmt = con.createStatement();
     setStatement(stmt);
     rs = stmt.executeQuery(sql);
     setResultSet(rs);
   } catch (Exception e) {
     Debug.warning(e);
     return false;
   }
   return true;
 }
 public int update(String sql) {
   int numOfUpdated = 0;
   try {
     Statement stmt = getStatement();
     if (stmt != null) {
       stmt.close();
       setStatement(null);
     }
     ResultSet rs = getResultSet();
     if (rs != null) {
       rs.close();
       setResultSet(null);
     }
     Connection con = getConnection();
     if (con == null) return 0;
     stmt = con.createStatement();
     numOfUpdated = stmt.executeUpdate(sql);
     stmt.close();
   } catch (Exception e) {
     Debug.warning(e);
   }
   return numOfUpdated;
 }