I suspect that some part of your code is calling system.exit() which will cause the database to shut down.
On Friday, 17 January 2014, Piero Molino <piero.mol...@gmail.com> wrote: > Hello, > > I'm trying to add some rows to a database with multiple threads. > I create a connection, i assign it to each thread and then each thread > does the inserts. > After a certain variable amount of time, everything stops working and i > get the following error: > > Grave: Error in the SQL > org.h2.jdbc.JdbcSQLException: Database is already closed (to disable > automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db > URL) [90121-174] > at org.h2.message.DbException.getJdbcSQLException(DbException.java:332) > at org.h2.message.DbException.get(DbException.java:172) > at org.h2.message.DbException.get(DbException.java:149) > at org.h2.message.DbException.get(DbException.java:138) > at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1413) > at org.h2.jdbc.JdbcConnection.checkClosed(JdbcConnection.java:1388) > at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:265 > at com.myapp.YADatabaseManager.insertYArow(YADatabaseManager.java:307) > > the YADatabaseManager.java:307 points to the creation of a prepared > statement: > statement = connection.prepareStatement(queryString); > > But i have never closed the database connection from my code, there's only > one close line but it is runned after all the threads have finished. > > I also tried to open a different connection for each thread, but the > result is exactly the same. As the error occurs after several hours it's > quite hard to reproduce. The last time i tried it broke after 2 hours when > the db was 800mb approximatively. > > The version of h2 is 1.3.174 and the jdbc connection string is: > jdbc:h2:/Users/w4nderlust/ya_db/2011/database/database > > Any idea of what could be the cause and what can i do to solve it? > How can i give a better explaination? (considered that the dataset is huge > and the process is really heavy?) > > Thanks, > Piero > > -- > 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 <javascript:_e({}, > 'cvml', 'h2-database%2bunsubscr...@googlegroups.com');>. > To post to this group, send email to > h2-database@googlegroups.com<javascript:_e({}, 'cvml', > 'h2-database@googlegroups.com');> > . > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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/groups/opt_out.