public ResultSet fExecuteQuery(String sSQL, Connection conn) {
   try {
     Statement stmnt = null;
     stmnt = conn.createStatement();
     ResultSet rs = null;
     if (sSQL.toUpperCase().indexOf("INSERT") > -1
         || sSQL.toUpperCase().indexOf("UPDATE") > -1
         || sSQL.toUpperCase().indexOf("CREATE") > -1
         || sSQL.toUpperCase().indexOf("DROP") > -1) {
       int count = stmnt.executeUpdate(sSQL);
       Dictionary.put("UPDATE_COUNT", String.valueOf(count));
       Dictionary.put("STMT_TYPE", sSQL.toUpperCase().split(" ")[0].trim());
     } else {
       rs = stmnt.executeQuery(sSQL);
     }
     stmnt.closeOnCompletion();
     return rs;
   } catch (SQLException eSQL) {
     log.info("Threw a Exception in DBActivities::fExecuteQuery, full stack trace follows:", eSQL);
     return null;
   } catch (Exception e) {
     log.info("Threw a Exception in DBActivities::fExecuteQuery, full stack trace follows:", e);
   }
   return null;
 }
Beispiel #2
0
 /**
  * @throws SQLException
  * @see java.sql.Statement#closeOnCompletion()
  */
 public void closeOnCompletion() throws SQLException {
   st.closeOnCompletion();
 }
 @Test(expected = SQLFeatureNotSupportedException.class)
 public void assertCloseOnCompletion() throws SQLException {
   actual.closeOnCompletion();
 }
 public void closeOnCompletion() throws SQLException {
   this.closeOnCompletion = true;
   inner.closeOnCompletion();
 }