Search Postgresql Archives

JDBC Transactions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux