public Connection initConnectionRestoreFromBackup(String backedUpDBLocation) throws AdeException {
  final String connectionUrl=dbURL + ";rollForwardRecoveryFrom=" + backedUpDBLocation+ File.separator+ dbName;
  mLogger.debug("Loading driver " + dbDriver);
  try {
    Class.forName(dbDriver);
  }
 catch (  ClassNotFoundException e) {
    throw new AdeInternalException("Loading driver failed",e);
  }
  mLogger.info("Connecting to database " + connectionUrl + " to restore from backup.");
  Connection con;
  try {
    if (dbUserName == null || dbUserPassword == null) {
      con=DriverManager.getConnection(connectionUrl);
    }
 else {
      con=DriverManager.getConnection(connectionUrl,dbUserName,dbUserPassword);
    }
    if (con != null) {
      try {
        con.commit();
        con.close();
      }
 catch (      SQLException e) {
        mLogger.error("The restored connection could not be closed.",e);
        throw new AdeExtUsageException("The connection could not be closed.",e);
      }
    }
    initConnection();
  }
 catch (  SQLException e) {
    throw new AdeInternalException("Failed obtaining connection",e);
  }
  return con;
}

public Connection initConnectionRestoreFromBackup ( String backedUpDBLocation ) throws AdeException { final String connectionUrl = dbURL + ";rollForwardRecoveryFrom=" + backedUpDBLocation + File . separator + dbName ; mLogger . debug ( "Loading driver " + dbDriver ) ; try { Class . forName ( dbDriver ) ; } catch ( ClassNotFoundException e ) { throw new AdeInternalException ( "Loading driver failed" , e ) ; } mLogger . info ( "Connecting to database " + connectionUrl + " to restore from backup." ) ; Connection con ; try { if ( dbUserName == null || dbUserPassword == null ) { con = DriverManager . getConnection ( connectionUrl ) ; } else { con = DriverManager . getConnection ( connectionUrl , dbUserName , dbUserPassword ) ; } if ( con != null ) { try { con . commit ( ) ; con . close ( ) ; } catch ( SQLException e ) { mLogger . error ( "The restored connection could not be closed." , e ) ; throw new AdeExtUsageException ( "The connection could not be closed." , e ) ; } } initConnection ( ) ; } catch ( SQLException e ) { throw new AdeInternalException ( "Failed obtaining connection" , e ) ; } return con ; }
restores the primary db from a given backed - up location . then , reinitializes the connection .
