I want to ask whether there is a possibility to access a database with one process as in-process database (over the jdbc:hsqldb:file: connection), and - in parallel - with other processes, also as file-connection, but in READ ONLY mode. Thus, a 'one provider-several consumers' scenario could be realized.
Everything I found was the readonly=true flag inside the database property file - I think in this case read access for several processes would be possible, but no write access even from one process.
Thanks in advance for your help - even if you will tell me that this is not possible ;)
Christian Reuschling
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You want one process to write and others to read from the database. This is not possible because each process has data caches and cannot see changes that are made by other processes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should still be able to achieve your goals by using a normal account connection from your R/W process, and use a R/O account for connections from the others. By R/O account, I mean you create an account and grant it only SEL/USE privs.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You need to run a Server to access the database from multiple processes (for reasons that Fred explained). The Server JVM uses "file" type JDBC URLs to open (and directly access, if necessary) the instance. The other processes connect to the server through "hsql" type JDBC URLs.
I've used this idiom hundreds of times to provide read-only access to a subset of db objects, for apps and users that don't need full access.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello gods of HSQLDB,
I want to ask whether there is a possibility to access a database with one process as in-process database (over the jdbc:hsqldb:file: connection), and - in parallel - with other processes, also as file-connection, but in READ ONLY mode. Thus, a 'one provider-several consumers' scenario could be realized.
Everything I found was the readonly=true flag inside the database property file - I think in this case read access for several processes would be possible, but no write access even from one process.
Thanks in advance for your help - even if you will tell me that this is not possible ;)
Christian Reuschling
You want one process to write and others to read from the database. This is not possible because each process has data caches and cannot see changes that are made by other processes.
You should still be able to achieve your goals by using a normal account connection from your R/W process, and use a R/O account for connections from the others. By R/O account, I mean you create an account and grant it only SEL/USE privs.
Hello unsaved,
I have tried your scenario with the different users, but I still get the exception:
java.sql.SQLException: The database is already in use by another process: org.hsqldb.persist.NIOLockFile@1000e634[file
seems that it is even not possible, as I worried it - thanks for your replies
Chris
You need to run a Server to access the database from multiple processes (for reasons that Fred explained). The Server JVM uses "file" type JDBC URLs to open (and directly access, if necessary) the instance. The other processes connect to the server through "hsql" type JDBC URLs.
I've used this idiom hundreds of times to provide read-only access to a subset of db objects, for apps and users that don't need full access.