title: Restrict postges access from java clients by using java program on a server
body: <p>Perhaps this question is not very clear but I didn't find better words for the heading, which describes the problem I like to deal with shortly.</p>
  
  <p>I want to restrict access from a java desktop application to postgres. </p>
  
  <p><strong>The background:</strong></p>
  
  <p>Suppose you have 2 apps running and the first Application has to do some complex calculations on the basis of data in the db. To nail the immutability of the data in the db down i'd like to lock the db for insert, update and delete operations. On client side i think it's impossible to handle this behaviour satisfactory. So i thought about to use a little java-app on server-side which works like a proxy. So the task is to hand over CRUD (Create Read Update Delete) operations until it gets a command to lock. After a lock it rejects all CUD operations until it gets a unlock command from the locking client or a timeout is reached.</p>
  
  <p><strong>Questions:</strong></p>
  
  <p>What do you think about this approach?</p>
  
  <p>Is it possible to lock a Database while using such an approach?</p>
  
  <p>Would you prefer Java SE or Java EE as server-side java app?</p>
  
  <p>Thanks in advance.</p>