I am making a small application and I am using the embedded derby database ,I want the application to be able to save the whole database onto a single file which can be stored on the hard drive and also import the database by opening this file in the future.Any clues or examples on how can I do it?
This might help you out!
1- Resource 1 with all detail
2- Resource 2 with Export Detail only
3- Using Java to Export/Import Using Jdbc
To export all the data from a table to a single export file, including the LOB data
SYSCS_UTIL.SYSCS_EXPORT_TABLE (IN SCHEMANAME VARCHAR(128), IN TABLENAME VARCHAR(128), IN FILENAME VARCHAR(32672), IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1), IN CODESET VARCHAR(128))
To export the result of a SELECT statement to a single file, including the LOB data
SYSCS_UTIL.SYSCS_EXPORT_QUERY (IN SELECTSTATEMENT VARCHAR(32672), IN TABLENAME VARCHAR(128), IN FILENAME VARCHAR(32672), IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1), IN CODESET VARCHAR(128))
Import and export procedures from JDBC
You can run import and export procedures from a JDBC program.
The following code fragment shows how you might call the SYSCS_UTIL.SYSCS_EXPORT_TABLE procedure from Java. In this example, the procedure exports the data in the staff table in the default schema to the staff.dat file. A percentage (%) character is used to specify the column delimiter.
PreparedStatement ps=conn.prepareStatement(
"CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE (?,?,?,?,?,?)");
ps.setString(1,null);
ps.setString(2,"STAFF");
ps.setString(3,"staff.dat");
ps.setString(4,"%");
ps.setString(5,null);
ps.setString(6,null);
ps.execute();