Re: ArrayIndexOutOfBoundsException when exporting to sql

125 views
Skip to first unread message

Thomas Mueller

unread,
Jul 18, 2012, 1:32:47 PM7/18/12
to h2-da...@googlegroups.com
Hi,

I'm afraid you will need to use the Recover tool to extract the data. I have a few questions:

- With which version of H2 was this database created?
    You can find it out using:
    select * from information_schema.settings where name='CREATE_BUILD'
    or have a look in the SQL script created by the recover tool.

- What is your database URL?

- Did you use LOG=0 or LOG=1? Did you read the FAQ about it?

- Did the system ever run out of disk space?

Regards,
Thomas


On Wednesday, July 18, 2012, Yann Biancheri wrote:
Hello,

I'm using h2 in my project and I've been able to export my data to sql without issues until today. On a client database I have this exception when trying to export the database to sql.

Here is the exception for reference.
 java -cp ~/.m2/repository/com/h2database/h2/1.3.168/h2-1.3.168.jar org.h2.tools.Script -url "jdbc:h2:~/db" -user "sa" -script "~/backup.sql"
Exception in thread "main" org.h2.jdbc.JdbcSQLException: General error: "java.lang.ArrayIndexOutOfBoundsException: 0"; SQL statement:
SCRIPT [50000-168]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
at org.h2.message.DbException.get(DbException.java:158)
at org.h2.message.DbException.convert(DbException.java:281)
at org.h2.command.Command.executeQuery(Command.java:195)
at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:76)
at org.h2.tools.Script.process(Script.java:172)
at org.h2.tools.Script.execute(Script.java:153)
at org.h2.tools.Script.execute(Script.java:133)
at org.h2.tools.Script.runTool(Script.java:101)
at org.h2.tools.Script.main(Script.java:51)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at org.h2.index.PageDataLeaf.getRowAt(PageDataLeaf.java:327)
at org.h2.index.PageDataCursor.nextRow(PageDataCursor.java:97)
at org.h2.index.PageDataCursor.next(PageDataCursor.java:49)
at org.h2.command.dml.ScriptCommand.query(ScriptCommand.java:295)
at org.h2.command.CommandContainer.query(CommandContainer.java:86)
at org.h2.command.Command.executeQuery(Command.java:191)
... 6 more

I can still read and write on the database without issues but the script export won't work. Is there anything I can do?
I've already tried to run the command against different h2  versions 1.2.128, 1.2.147 and 1.3.168 but all generate the same exceptions

--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/8NGAFym8vhMJ.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

Yann Biancheri

unread,
Jul 19, 2012, 3:33:09 AM7/19/12
to h2-da...@googlegroups.com
Thanks for your quick answer. I've run the recover tool and restored my database fine.

The database has been created with h2 version 128.
For the database url we use the absolute path to the file prefixed with jdbc:h2: and we remove the h2.db suffix (ex. jdbc:h2:/Users/yann/Documents/database)
I didn't knew about the LOG parameter and didn't modify it.
I'll ask our client to know if he has ever runed out of disk space and let you know.

Thanks again for your support.

Regards,
Yann
To unsubscribe from this group, send email to h2-database+unsubscribe@googlegroups.com.

Yann Biancheri

unread,
Jul 19, 2012, 12:01:40 PM7/19/12
to h2-da...@googlegroups.com
Before the database got corrupted, the client's machine crashed while the database was opened. It might be related to this.
Reply all
Reply to author
Forward
0 new messages