0

I was able to get it to create the table with memory but now that I changed to to a file it wont create the table on the first run.

I used spring.datasource.initialization-mode=always but after the first run it would just break.

Here is all I have right now:

spring.h2.console.enabled=true
spring.datasource.initialization-mode=always
#spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.url=jdbc:h2:file:./data/maindb

I've looked around but count find an answer that helped.

GStraats
  • 1
  • 1
  • 1
    any stacktrace or exception that thrown after your ran your application? – MK Tan Dec 19 '20 at 03:00
  • @MKTan this is the first line of the stack trace: ```org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-200]``` – GStraats Dec 19 '20 at 04:13
  • Does the answer in https://stackoverflow.com/questions/8158969/h2-database-error-database-may-be-already-in-use-locked-by-another-process provided any help? – MK Tan Dec 19 '20 at 05:12
  • it would be great if you could edit your code with some more details, necessary dependencies maven/Gradle. and the entire stack trace etc., by the way, did you put the property `spring.datasource.driverClassName=org.h2.Driver` to the `application.properties` – Vikum Dheemantha Dec 19 '20 at 05:31

0 Answers0