It isn't safe to backup the file that way. You need to use the inbuilt backup command if the database is in use.

http://h2database.com/html/grammar.html#backup

http://h2database.com/javadoc/org/h2/tools/Backup.html





On 3/09/2014 6:27 AM, Kam wrote:
I don't know what's causing it. We have a feature that backs up the H2 DB file and zips it via java. the DB is in use when we back it up (all it does is copy the h2 file) When we tried to use it, it's corrupted. This is the stack trace when I try to open it ZipOutputStream append = new ZipOutputStream(new FileOutputStream(fileFullPath));

java version "1.7.0_55" on mac and file size is 1.4 MBs and we have a lot of / (slashes) stored. I am not sure where to begin to find it. Is it H2 ? is it our code writing/copying the file? (tests can't reproduce it) What is this error ?



>java -cp lib/h2*.jar org.h2.tools.Shell -url "jdbc:h2:./data/path;CIPHER=AES;TRACE_LEVEL_SYSTEM_OUT=0;ALLOW_LITERALS=NUMBERS" -user sa -password "pass1 pass1"

Exception in thread "main" org.h2.jdbc.JdbcSQLException: General error: "java.lang.ArrayIndexOutOfBoundsException: 4" [50000-173]

at org.h2.message.DbException.getJdbcSQLException(DbException.java:331)

at org.h2.message.DbException.get(DbException.java:160)

at org.h2.message.DbException.convert(DbException.java:283)

at org.h2.table.RegularTable.removeRow(RegularTable.java:397)

at org.h2.store.PageStore.redo(PageStore.java:1537)

at org.h2.store.PageStore.redoDelete(PageStore.java:1511)

at org.h2.store.PageLog.recover(PageLog.java:334)

at org.h2.store.PageStore.recover(PageStore.java:1371)

at org.h2.store.PageStore.openExisting(PageStore.java:361)

at org.h2.store.PageStore.open(PageStore.java:285)

at org.h2.engine.Database.getPageStore(Database.java:2210)

at org.h2.engine.Database.open(Database.java:603)

at org.h2.engine.Database.openDatabase(Database.java:226)

at org.h2.engine.Database.<init>(Database.java:221)

at org.h2.engine.Engine.openSession(Engine.java:56)

at org.h2.engine.Engine.openSession(Engine.java:160)

at org.h2.engine.Engine.createSessionAndValidate(Engine.java:139)

at org.h2.engine.Engine.createSession(Engine.java:122)

at org.h2.engine.Engine.createSession(Engine.java:28)

at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:313)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:105)

at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:90)

at org.h2.Driver.connect(Driver.java:73)

at java.sql.DriverManager.getConnection(DriverManager.java:571)

at java.sql.DriverManager.getConnection(DriverManager.java:215)

at org.h2.tools.Shell.runTool(Shell.java:147)

at org.h2.tools.Shell.main(Shell.java:80)

Caused by: java.lang.ArrayIndexOutOfBoundsException: 4

at org.h2.index.PageBtree.getRow(PageBtree.java:172)

at org.h2.index.PageBtreeLeaf.remove(PageBtreeLeaf.java:228)

at org.h2.index.PageBtreeIndex.remove(PageBtreeIndex.java:238)

at org.h2.table.RegularTable.removeRow(RegularTable.java:379)

... 23 more



--
You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com <mailto:h2-database+unsubscr...@googlegroups.com>. To post to this group, send email to h2-database@googlegroups.com <mailto:h2-database@googlegroups.com>.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to