Unsupported connection option 'INIT'
P粉107772015
P粉107772015 2023-09-08 16:56:16
0
1
501

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粉107772015
P粉107772015

reply all(1)
P粉007288593

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:

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template