I would like to embed a Derby database in a servlet-based application running on Tomcat.
For this purpose, I need to persist the database files on the disk. I would prefer for them to reside in a sub-folder of the deployed web application (which I could then convert using getServletContext().getRealPath()
).
Is there a good practice wrt acceptable, application-relative locations where a servlet could safely write to? If no such recommendation exists, what would be a tomcat-specific good practice?
This discussion seems to rule out writing in WebContent
; will I have to write to a CATALINA_HOME
sub-folder, as some tutorials point to (but it feels hackish)?