problem with INIT=RUNSCRIPT and relative paths
Solution 1:
You can use the following url:
"jdbc:h2:mem:sample;INIT=RUNSCRIPT FROM 'classpath:scripts/create.sql'"
With that one it is possible to run script from classpath. So you can just put it src/main/resources/scripts or src/test/resources/scripts in your maven (or something else) project.
Solution 2:
I'd suggest trying to use an absolute path for starters, just to check everything works. Afterwards, check your classpath. For example, bin/main/resources/scripts/create.sql
, assuming bin
is where your classes are compiled, and is on your classpath.
Since src
, where your source lives, usually isn't on the classpath, this could be the source of your problem.