Home  >  Q&A  >  body text

Unsupported connection option 'INIT'

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粉107772015P粉107772015430 days ago464

reply all(1)I'll reply

  • P粉007288593

    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:

    reply
    0
  • Cancelreply