Good night friends, I have a doubt that I can not solve it.
I have a JAVAFX, H2 and Liquibase application, I need to restore my backup without deleting all my objects.
1- I can already do my backup
2 - I can already restore it, but only before deleting all my base.
3- How can I restore the backup using for example the update of all tables or merge.
I will put as my implementations and thank you very much who can help.
public class H2DatabaseBackup implements DatabaseBackup {
@Override // Backup WORKS 100%
public void backupDatabase (Connection conn, String file) throws SQLException {
PreparedStatement statement = conn.prepareStatement ("SCRIPT TO?");
statement.setString (1, file);
statement.execute ();
}
@Override // HOW TO IMPORT
public void importDatabase (Connection conn, String file1) throws SQLException {
PreparedStatement statement = conn.prepareStatement ("RUNSCRIPT FROM?"); // NEED HELP
statement.setString (1, file1);
statement.execute ();
}
@Override // WORKS 100%
public void resetDatabase (Connection conn, String file2) throws SQLException {
PreparedStatement preparedStatement = conn.prepareStatement ("DROP ALL OBJECTS;");
preparedStatement.executeUpdate ();
PreparedStatement statement = conn.prepareStatement ("RUNSCRIPT FROM?");
statement.setString (1, file2);
statement.execute ();
}
}