i am developing a web application project using Apache Tomcat and Apache Derby. I have successfully created an embedded database and i can connect to it. The problem is that the DB is being created/connected to a path relative to the machine in which the project is run. I want to export the entire database inside the Java project but i cannot understand how to do it. There are two problems:
- In which folder should i put the Database?
- How should i specify the path to connect with JDBC?
I have tried different approaches with getServletContext() and other methods but the only folder i can specify are relative to the Apache installation folder or the out artifact one.
The purpose of this operation is to make the project (that doesn't aim to production) portable, so that the Database is already present and populated.