I don't understand what the problem is and how to look at it. Second month of programming
1 location error
private static String dbUrl = "jdbc:h2:mem:test; INIT = RUNSCRIPT FROM classpath:init.sql' ";`
2 text errors
Exception in thread "main" java.lang.RuntimeException: >org.h2.jdbc.JdbcSQLNonTransientConnectionException: >Connection option "INIT" not supported
Unsupported connection setting "INIT" [90113-200]
3 possible reasons for the error
P粉0072885932023-09-09 12:31:22
Try this:
static String dbUrl = "jdbc:h2:mem:test;INIT=RUNSCRIPT FROM 'classpath:init.sql'";
Please note that the specific spaces (...;INIT=RUNSCRIPT ...
) were removed from the example in the question and the use of single quotes around 'classpath:init. sql'
(the problem is missing a single quote).
See the RUNSCRIPT documentation for examples, including: