0

I try to deploy an application on Tomcat. The application uses a database. But Tomcat cannot store it, because He tries storing in the root directory of the server, where he has no permission of course, log says:

Error opening database: "Could not save properties /sudoDb.lock.db" [8000-176] 

How can I configure Tomcat to store anywhere, that is permitted, eg. TOMCAT_HOME or anywhere else.

thanks for any hint

Selaron
  • 6,105
  • 4
  • 31
  • 39
user3647093
  • 363
  • 1
  • 6
  • 17
  • Please provide details about your used frameworks, configuration and source code and at minimum least a full exception StackTrace. – Selaron Dec 03 '18 at 08:05
  • it is a grails application, where I only can configure url = "jdbc:h2:sudoDb;...." I have deployed the application on another tomcat, where tomcat stores database in TOMCAT_HOME/bin and everything works fine. I repeat my question: Can I tell tomcat, where to store where to store the database. If such a simple question cannot be answered without stacktrace and config Information I must suppose database storing by tomcat is random. – user3647093 Dec 03 '18 at 13:01
  • Apache Tomcat is not a DBMS. It is a servlet container and as such it simply does not store a database. This implies that you must be using a third party module that does. A stack trace would have easily revealed which module you are using and where stuff goes wrong. But luckily you mentioned the `url = "jdbc:h2:sudoDb;...."` which suggests you are using a H2 JDBC driver of unknown version that is able to store a database. This might help: https://www.h2database.com/html/faq.html#database_files – Selaron Dec 03 '18 at 15:37
  • Thank you for the answer, tried it and works fine – user3647093 Dec 03 '18 at 19:59

1 Answers1

0

As my webApp is based on grails and h2 defining the database location in config.DataSource worked for me. I simply defined:

url = "jdbc:h2:file:/vol/h2/sudoDb.... 

and the database was stored by tomcat in /vol/h2 of my target linux. This is indeed not an operating system independent solution as it only works for tomcats running on linux. For windows still a recompile with another url='...' is needed.

user3647093
  • 363
  • 1
  • 6
  • 17