I am working on building a web application that uses a simple .db (SQLite) file in a Jakarta EE Servlet Project. When trying to access the database file which is stored in the project root like any non web-app project will recognize, it doesn’t find it. I want to know where can I put the database file in the project to simply use the “animal.db” for the URL of the database.
It currently works right now if I do the absolute path, but that can change from computer to computer. I have the resources in context.xml and web.xml for Tomcat 10. But the problem is I want to have use just the name of the database “animal.db” as the URL for the database like a normal non-web application would but it never finds it.
I have tried putting it in the webapp, WEB-INF, and resource folders. But it doesn’t see it. I would prefer to keep it in the IntelliJ project and not the Tomcat server folder. All searches I have tried don’t really touch on this as most just use MySQL or some other but I am trying to keep my application simple.
Project Structure:
Image of project structure
The url that does work and connects with full location:
The URL of the database
user25393830 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.