public static void recover(File file){
  Connection c=null;
  ResultSet r1=null;
  Statement stat=null;
  try {
    ZipInputStream zip=new ZipInputStream(new FileInputStream(file));
    zip.getNextEntry();
    BufferedReader in=new BufferedReader(new InputStreamReader(zip));
    c=getConnection();
    DatabaseMetaData m1=c.getMetaData();
    r1=m1.getTables(null,null,null,new String[]{"TABLE"});
    while (r1.next()) {
      try {
        stat=c.createStatement();
        stat.execute("delete from " + r1.getString("TABLE_NAME"));
        stat.close();
        stat=null;
      }
 catch (      Exception e) {
        log.error("ignore this exception",e);
      }
    }
    String line=in.readLine();
    while (line != null) {
      _recover(line,c);
      line=in.readLine();
    }
    zip.closeEntry();
    in.close();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
  }
 finally {
    close(r1,stat,c);
  }
}

public static void recover ( File file ) { Connection c = null ; ResultSet r1 = null ; Statement stat = null ; try { ZipInputStream zip = new ZipInputStream ( new FileInputStream ( file ) ) ; zip . getNextEntry ( ) ; BufferedReader in = new BufferedReader ( new InputStreamReader ( zip ) ) ; c = getConnection ( ) ; DatabaseMetaData m1 = c . getMetaData ( ) ; r1 = m1 . getTables ( null , null , null , new String [ ] { "TABLE" } ) ; while ( r1 . next ( ) ) { try { stat = c . createStatement ( ) ; stat . execute ( "delete from " + r1 . getString ( "TABLE_NAME" ) ) ; stat . close ( ) ; stat = null ; } catch ( Exception e ) { log . error ( "ignore this exception" , e ) ; } } String line = in . readLine ( ) ; while ( line != null ) { _recover ( line , c ) ; line = in . readLine ( ) ; } zip . closeEntry ( ) ; in . close ( ) ; } catch ( Exception e ) { log . error ( e . getMessage ( ) , e ) ; } finally { close ( r1 , stat , c ) ; } }
recover the data from the file
