0

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'

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

I found that this worked for me

runscript from 'classpath:LoadData.sql'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.