Reputation: 423
I am trying to load some data from a script in a H2 database in a spring boot application but I am getting the File Not Found Exception. I have the yml file and Data File in the same directory. The two files exists in src/main/resources/config
url: jdbc:h2:mem:test;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS pdmp_app\;runscript from 'LoadData.sql'
Upvotes: 0
Views: 8158
Reputation: 36
I found that this worked for me
runscript from 'classpath:LoadData.sql'
Upvotes: 0
Reputation: 24561
Instead of using H2 script execution, I would suggest to use Spring Boot initialization SQL scripts. Just place your script into file src/main/resources/data.sql
and Spring Boot will take care of executing it.
Upvotes: 1