/**
   * static method testing jdbc framework with multiple updates and intentional sql exceptions that
   * are trapped in appropriate exception handling blocks
   */
  public static void testMultipleUpdatesAndTransWithException() {
    ConnectionPool conPool = getConnectionPool();
    SQLExecutor sqlExec = new SQLExecutor(conPool);
    try {
      sqlExec.setAutoCommit(false);
      sqlExec.addParam(new Integer(7));
      sqlExec.runQuery("UPDATE JDBC_TEST SET CODE = 'Z' WHERE TEST_ID = ?");

      sqlExec.addParam(new Integer(6));
      // integrity constraint violation
      sqlExec.runQuery("UPDATE JDBC_TEST SET TEST_ID = NULL WHERE TEST_ID = ?");

      sqlExec.commitTrans();
      System.out.println("transaction committed");
    } catch (DatabaseException e) {
      System.out.println("Error code=" + e.getSQLErrorCode() + ",  SQLState=" + e.getSQLState());
      if (e.isDataIntegrityViolation()) System.out.println("data integrity violation");
      else if (e.isBadSQLGrammar()) System.out.println("bad SQL grammar");
      else if (e.isNonExistentTableOrViewOrCol()) System.out.println("Non existent table or view");
      System.out.println(e.getMessage());
      sqlExec.rollbackTrans();
      System.out.println("transaction rolled back");
    } finally {
      sqlExec.closeConnection();
    }
  }