Ejemplo n.º 1
0
 /**
  * If this is a Derby database, force a checkpoint so that the disk space occupied by the
  * transaction log is freed as early as possible.
  */
 private void checkpointDatabase(ConnectionResource conn) throws SQLException {
   DatabaseMetaData dmd = conn.getMetaData();
   if (procedureExists(dmd, "SYSCS_UTIL", "SYSCS_CHECKPOINT_DATABASE")) {
     try (Statement s = conn.createStatement()) {
       s.execute("CALL SYSCS_UTIL.SYSCS_CHECKPOINT_DATABASE()");
     }
     conn.commit();
   }
 }
Ejemplo n.º 2
0
 @Override
 public void initialize() throws HistoryException {
   try {
     connectionManager = new ConnectionManager(jdbcDriverClass, jdbcConnectionURL);
     for (int i = 0; ; i++) {
       final ConnectionResource conn = connectionManager.getConnectionResource();
       try {
         try (Statement stmt = conn.createStatement()) {
           initDB(stmt);
         }
         conn.commit();
         // Success! Break out of the loop.
         return;
       } catch (SQLException sqle) {
         handleSQLException(sqle, i);
       } finally {
         connectionManager.releaseConnection(conn);
       }
     }
   } catch (Exception e) {
     throw new HistoryException(e);
   }
 }