6

My conf (working):

    jdbc-url: jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_1

I need to init mulitple schema, but i can't find the syntax. So far I tried:

jdbc-url: jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_1, MYSCHEMA_2
jdbc-url: jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_1;CREATE SCHEMA IF NOT EXISTS MYSCHEMA_2
jdbc-url: jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_2
Tyvain
  • 2,640
  • 6
  • 36
  • 70

1 Answers1

20

Solution is:

jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS SCHEMA_1\;CREATE SCHEMA IF NOT EXISTS SCHEMA_2

note the simple '\' in yml. Double '\\' in java is to escape the first one.

Tyvain
  • 2,640
  • 6
  • 36
  • 70
  • That file format is called [YAML](http://yaml.org/spec/1.2/spec.html) and the file extension to use for files in that format is [`.yaml`](http://yaml.org/faq.html) when possible. So where does the "yml" come form? I hope you are not running an 8.3 filesystem for your `.jva` programs. – Anthon Oct 23 '18 at 06:41
  • De verdad muchas gracias, me sirvió con los doble \\ – arxzel Apr 26 '22 at 20:41
  • on yaml i must use '\\' otherwise -> java.lang.IllegalStateException: Failed to load property source from (classpath:application-test.yaml) – Tiago Medici May 12 '22 at 07:56