Timeout error trying to lock table in h2

Yes, you can change the lock timeout. The default is relatively low: 1 second (1000 ms). In many cases the problem is that another connection has locked the table, and using multi-version concurrency also solves the problem (append ;MVCC=true to the database URL). EDIT: MVCC=true param is no longer supported, because since h2 1.4.200 it’s … Read more

Executing script file in h2 database

You can use the RUNSCRIPT SQL statement: RUNSCRIPT FROM ‘test.sql’ or you can use the RunScript standalone / command line tool: java -cp h2*.jar org.h2.tools.RunScript -url jdbc:h2:~/test -script test.sql You can also use the RunScript tool within an application: RunScript.execute(conn, new FileReader(“test.sql”));