Memory DB keeps executing INIT SQL

50 views
Skip to first unread message

JetForMe

unread,
Dec 6, 2012, 11:43:05 AM12/6/12
to h2-da...@googlegroups.com
I've got a Spring/Hibernate/JUnit test set up against an in-memory H2 DB. The URL is set up like this:

dataSource.setURL("jdbc:h2:mem:gcs;MODE=MySQL;DB_CLOSE_DELAY=-1;IGNORECASE=false;INIT=RUNSCRIPT FROM 'src/sql/schema.sql'");


But it's executing the schema for each connection. I only create the DB once in my unit tests (in a @BeforeClass method), but it seems that each connection is causing it to re-execute the INIT script.

Prior to this, I didn't have DB_CLOSE_DELAY=-1, but then the DB contents were lost after each connection closed.

I'm not sure how I'm supposed to use this if this is the correct behavior.
Reply all
Reply to author
Forward
0 new messages