Niklas P
Niklas P

Reputation: 3507

hsqldb - no sync between applications

I use a datasource (directing to a file-based hsqldb) from two applications in parallel and in one of them I edit an entry (no matter if I use commit or checkpoint as sql commands), my other application don't realise this change until I restart the other application.

I am using

Within the apache-tomcat-8.0.26/conf/context.xml file I've defined a resource named jdbc/xyz of type javax.sql.DataSource to my file-based hsqldb (url: jdbc:hsqldb:file:/myfolder/mydatabase;shutdown=true;hsqldb.lock_file=false).

If I use this datasource only from one application deployed on the tomcat server and do the editing I have no problems.

Do you have any ideas what the reason for this strange behaviour could be? Thanks in advance.

Upvotes: 0

Views: 296

Answers (1)

fredt
fredt

Reputation: 24352

Only a single java process can access a jdbc:hsqldb:file database. You need to start an HSQLDB Server. The server can be started in the process that runs Tomcat. You can then connect to this server with jdbc:hsqldb:hsql: protocol.

Upvotes: 1

Related Questions