How to load h2 database using a static sql file, from src/main/resources/data.sql of my Spring Boot App. I am unable to load the database in the following fashion as its unable to get the data.sql file. I won't be able to get the absolute path as it wouldn't work in a docker container
spring.datasource.url=jdbc:h2:file:src/main/resources/data.sql
By default, Spring Boot automatically loads SQL from schema.sql
and data.sql
files.
You should place these files in src/main/resources
folder, that's it.
If your h2 db is properly configured it should work out of the box.