private boolean[] lockDB(NodeCentricOperationContext connectionContext) {
   boolean ownsIt = false;
   try {
     connectionContext
         .getStatementProvider()
         .runSQLGroup(
             initServerStatement, datasource.getInitParams(), connectionContext.getConnection());
     ownsIt = true;
   } catch (SQLException sqle) {
     if (log.isDebugEnabled()) {
       log.debug(LogUtils.RDB_MARKER, "SQL Error initializing SERVER table", sqle);
     }
   } catch (RdbException sqle) {
     if (log.isDebugEnabled()) {
       log.debug(LogUtils.RDB_MARKER, "SQL Error initializing SERVER table", sqle);
     }
   }
   try {
     int counter =
         ServerRdbWrapper.setInitializing(
             connectionContext.getStatementProvider(),
             connectionContext.getConnection(),
             System.currentTimeMillis());
     if (counter == 0) {
       ServerRdbWrapper.setInitializingFailed(
           connectionContext.getStatementProvider(), connectionContext.getConnection());
       return new boolean[] {ownsIt, false};
     }
     return new boolean[] {ownsIt, true};
   } catch (AnzoException sqle) {
     if (log.isErrorEnabled()) {
       log.error(LogUtils.RDB_MARKER, "Error unlocking db", sqle);
     }
     return new boolean[] {ownsIt, false};
   }
 }
  private void dropTables(NodeCentricOperationContext connectionContext, boolean hardReset)
      throws AnzoException, SQLException {
    long start = System.currentTimeMillis();
    if (hardReset) {
      String[][] tableSets = {liveTables, nodeCentricTables, staticTables};
      datasource.begin(connectionContext.getConnection(), true, true);

      java.sql.Statement stmt = connectionContext.getConnection().createStatement();
      try {
        for (String view : views) {
          try {
            stmt.executeUpdate(
                dropView + datasource.getConfiguration().getDropExtras() + " " + view);
          } catch (SQLException sqle) {
            if (log.isTraceEnabled()) {
              log.trace(LogUtils.RDB_MARKER, "SQL Error droping view", sqle);
            }
          }
        }
        for (String[] sequenceVers : sequences) {
          if (sequenceVers != null) {
            for (String sequence : sequenceVers) {
              try {
                stmt.executeUpdate(
                    dropSequence + datasource.getConfiguration().getDropExtras() + " " + sequence);
              } catch (SQLException sqle) {
                if (log.isTraceEnabled()) {
                  log.trace(LogUtils.RDB_MARKER, "SQL Error droping sequence", sqle);
                }
              }
            }
          }
        }
        if (!connectionContext.getConfiguration().getSupportsIdentity()) {
          try {
            stmt.executeUpdate(
                dropSequence + datasource.getConfiguration().getDropExtras() + " LANG_SEQ");
          } catch (SQLException sqle) {
            if (log.isTraceEnabled()) {
              log.trace(LogUtils.RDB_MARKER, "SQL Error droping sequence", sqle);
            }
          }
          try {
            stmt.executeUpdate(
                dropSequence + datasource.getConfiguration().getDropExtras() + " DATATYPE_SEQ");
          } catch (SQLException sqle) {
            if (log.isTraceEnabled()) {
              log.trace(LogUtils.RDB_MARKER, "SQL Error droping sequence", sqle);
            }
          }
        }
        for (String[] tables : tableSets) {
          for (String table : tables) {
            try {
              stmt.executeUpdate(
                  dropTable + datasource.getConfiguration().getDropExtras() + " " + table);
            } catch (SQLException sqle) {
              if (log.isTraceEnabled()) {
                log.trace(LogUtils.RDB_MARKER, "SQL Error droping table", sqle);
              }
            }
          }
        }
        for (String table : tempTables) {
          try {
            stmt.executeUpdate(
                dropTable
                    + datasource.getConfiguration().getDropExtras()
                    + " "
                    + datasource.getConfiguration().getSessionPrefix()
                    + table);
          } catch (SQLException sqle) {
            if (log.isTraceEnabled()) {
              log.trace(LogUtils.RDB_MARKER, "SQL Error droping temptable", sqle);
            }
          }
        }
      } finally {
        try {
          stmt.close();
        } catch (SQLException sqle) {
          if (log.isTraceEnabled()) {
            log.trace(LogUtils.RDB_MARKER, "SQL Error closing statement", sqle);
          }
        }
        datasource.commit(connectionContext.getConnection(), true, true);
      }

      if (datasource.getConfiguration().getRequiresTempTablespace()
          && InsertStatementsRdbWrapper.getTempTablespaceDefined(
                  connectionContext.getStatementProvider(), connectionContext.getConnection())
              == 0) {
        datasource.begin(connectionContext.getConnection(), true, true);
        try {
          connectionContext
              .getStatementProvider()
              .runSQLGroup(initTablespace, new String[0], connectionContext.getConnection());
        } catch (SQLException sqle) {
          if (log.isErrorEnabled()) {
            log.error(LogUtils.RDB_MARKER, "SQL Error initializing tablespace", sqle);
          }
          throw sqle;
        } finally {
          datasource.commit(connectionContext.getConnection(), true, true);
        }
      }
      datasource.begin(connectionContext.getConnection(), true, true);
      try {
        connectionContext
            .getStatementProvider()
            .runSQLGroup(
                initDBtables, datasource.getInitParams(), connectionContext.getConnection());
        connectionContext
            .getStatementProvider()
            .runSQLGroup(
                initIndexes, datasource.getInitParams(), connectionContext.getConnection());
        connectionContext
            .getStatementProvider()
            .runSQLGroup(
                initSequences, datasource.getInitParams(), connectionContext.getConnection());
        datasource.commit(connectionContext.getConnection(), true, true);
      } catch (SQLException sqle) {
        log.error(LogUtils.RDB_MARKER, "Error initializing database tables", sqle);
        datasource.abort(connectionContext.getConnection(), true, true);
        throw new AnzoException(ExceptionConstants.RDB.FAILED_INITIALZE_DB, sqle);
      }
      try {
        datasource.begin(connectionContext.getConnection(), true, true);
        connectionContext
            .getStatementProvider()
            .runSQLGroup(
                "createTemporaryTables",
                datasource.getInitParams(),
                connectionContext.getConnection());
        datasource.commit(connectionContext.getConnection(), true, true);
      } catch (SQLException sqle) {
        log.error(LogUtils.RDB_MARKER, "Error initializing database temporary tables", sqle);
        datasource.abort(connectionContext.getConnection(), true, true);
        throw new AnzoException(ExceptionConstants.RDB.FAILED_INITIALZE_TEMPTABLES, sqle);
      }

    } else {
      String[][] tableSets = {liveTables, nodeCentricTables};
      datasource.begin(connectionContext.getConnection(), true, true);
      java.sql.Statement stmt = connectionContext.getConnection().createStatement();
      try {
        for (String[] tables : tableSets) {
          for (String table : tables) {
            try {
              BaseSQL.truncateTableMayCommit(
                  connectionContext.getStatementProvider(),
                  connectionContext.getConnection(),
                  table);
            } catch (RdbException sqle) {
              if (log.isErrorEnabled()) {
                log.error(LogUtils.RDB_MARKER, "SQL Error truncating table", sqle);
              }
            }
          }
        }
      } finally {
        try {
          stmt.close();
        } catch (SQLException sqle) {
          if (log.isTraceEnabled()) {
            log.trace(LogUtils.RDB_MARKER, "SQL Error closing statement", sqle);
          }
        }
        datasource.commit(connectionContext.getConnection(), true, true);
      }
    }
    if (log.isDebugEnabled()) {
      log.debug(LogUtils.RDB_MARKER, "[RESET DB] {}", (System.currentTimeMillis() - start));
    }
  }