From: | Jonathan Tripathy <jonnyt(at)abpni(dot)co(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | JDBC Transactions |
Date: | 2010-11-01 17:37:54 |
Message-ID: | 4CCEFAF2.7080500@abpni.co.uk |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Everyone,
I'm trying to create a server for a database system which will be used
by multiple clients. Of course, table locking is very important. Reading
the Postgresql docs, locking occurs on a transaction-by-transaction basis.
In our java code, we are doing this:
//Start Code Block
Connection con = "..."
con.setAutoComitt(false);
//Insert SQL here to lock table
String qry1 = "..."
pst1 = con.prepareStatement(qry1)
//Insert code here to add values to prepared statement pst1
pst1.executequery();
String qry2 = "..."
pst2 = con.prepareStatement(qry2)
//Insert code here to add values to prepared statement pst2
pst2.executequery();
con.comitt();
//End Code Block
My question is, would the above block of code be classed as a single
transaction, and would the locking work correctly?
Thanks
Jonny
From | Date | Subject | |
---|---|---|---|
Next Message | Jonathan Tripathy | 2010-11-01 17:42:28 | Connection Pool |
Previous Message | Scott Marlowe | 2010-11-01 17:32:23 | Re: 8.4 Data Not Compatible with 9.0.1 Upgrade? |