title: Multiple H2 database connections, different access modes
body: <p>I have two clients making separate connections to the same H2 database. I would like one of these connections to be read-only, and one to be read-write. To do this I am using the following connection strings:</p>
  
  <ul>
  <li><p>Read-only: <code>jdbc:h2:tcp://localhost/~/test;ACCESS_MODE_DATA=r</code></p></li>
  <li><p>Read-write: <code>jdbc:h2:tcp://localhost/~/test;ACCESS_MODE_DATA=rw</code></p></li>
  </ul>
  
  <p>My problem is that the access mode seems to be a property of the database rather than the connection. So when both clients are in use at the same time, the client that made the first connection will override the access mode of subsequent connections. If the read-write client connects when there is already a connection from the read-only client, no changes can be made to the database. Vice-versa, both clients can make changes if the read-write client was first. The access mode only seems to change when there are no existing connections.</p>
  
  <p>Is there any way I can solve this? Users with credentials that allow them to change the database should be able to do so in one client, but not in the other, so I cannot control this simply by granting different rights to different users.</p>