title: How does JDBC Transaction lock a table in TRANSACTION_READ_COMMITTED isolation level?
body: <p>I've read this tutorial: <a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/transactions.html" rel="nofollow">http://docs.oracle.com/javase/tutorial/jdbc/basics/transactions.html</a> but I think I'm still missing something.</p>
  
  <p>Let us take an example:</p>
  
  <ul>
  <li>Thread T1 has its own Connection </li>
  <li>Thread T2 has its own Connection</li>
  </ul>
  
  <p>So, these Threads perform a Transaction (setAutoCommit(false) on two different Connections). This Transaction executes, on a single DB Table, the following queries:</p>
  
  <ul>
  <li>Select a row to read a progressive number (PN)</li>
  <li>Insert a row setting the progressive number to: PN++ (what I've<br>
  read +1)</li>
  </ul>
  
  <p>The Progressive Number must be unique (it is Primary Key) in this Table.</p>
  
  <p>Do JDBC Transactions (with TRANSACTION_READ_COMMITTED isolation level) avoid the problem that T1 and T2 read the same value of PN and both try to insert in the table the same PN++? Is the Table locked until the Insert is performed and the commit() is called? </p>