1

I generated dump file from java using .dump command so my back-up is ready now I want to restore it to once again so can anyone help me how to restore?

In stackoverflow I got this but nothing restore from this..backup-and-restore-sqlite-from-disk-to-memory-in-java

so how to restore this file?

asked Oct 23, 2013 at 5:02
8
  • Java has no .dump command. If you've used .dump, it was in the sqlite3 command-line tool, which has nothing to do with Java. Commented Oct 23, 2013 at 12:05
  • @CL..ya I generated dump file in sqlite3 but generated dump file does not containing "Drop Table if exist" statement as it was in the SQLite manager generated file so can you help me for this? Commented Oct 24, 2013 at 4:34
  • sqlite3's dump file is intended to recreate everything in an empty database. Commented Oct 24, 2013 at 8:31
  • @CL..then I want dump file which restores in existing file then? like SQLiteManager does? Commented Oct 24, 2013 at 8:42
  • Just delete the database file first. Commented Oct 24, 2013 at 9:12

1 Answer 1

1

If you're using JDBC with Java, have a look at sqlite-jdbc by xerial. They added the backup and restore API of sqlite a while ago.

I use this together with an sqlite in memory-database for higher performance and regularly backup to a file.

You can use it like this:

// Use this connection string for an in memory-database
Connection connection = DriverManager.getConnection("jdbc:sqlite::memory:");
connection.createStatement().executeUpdate("restore from database.db");
connection.createStatement().executeUpdate("backup to database.db");
answered Oct 17, 2016 at 6:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.