title: postgresql triggers - defining a global resource (java)
body: <p>I have a PostgreSQL server and I need to run some code whenever an update happens on some table. The PostgreSQL triggers (using PL/java) allows me to call a static java method. The method I need to execute does an RPC to an external server with the information about what the update was.</p>
  
  <p>What I couldn't figure out is how I can create a global resource (in this case, the network conection with the external server) which persists across calls. </p>
  
  <p>One way is probably to create a static variables for the global resources. When my trigger method is called the first time, initialize those variables. In subsequent calls just use it. Will this work, and is there any other way?</p>
  
  <p>What I would have loved is a general trigger interface which I could implement for my trigger.</p>