title: Postgresql transaction handling with java
body: <p>I have two blocks of queries with preparedStatement.</p>
  <p>This is the first:</p>
  <pre><code>String sql = &quot;update cikan_malzeme set miktar = ? where proje_id = ? and malzeme_id = ?&quot;;
  PreparedStatement prep = dbConnect.connection.prepareStatement(sql);
  prep.setFloat(1, toplam);
  prep.setInt(2, pid);
  prep.setInt(3, mid);
  prep.executeUpdate();
  </code></pre>
  <p>And this is the second:</p>
  <pre><code>String sql2 = &quot;update malzemeler set miktar = ? where malz_adi = ?&quot;;
  PreparedStatement prep2 = dbConnect.connection.prepareStatement(sql2);
  prep2.setFloat(1, fark);
  prep2.setString(2, malzemeadi);
  prep2.executeUpdate();
  </code></pre>
  <p>Now I want to execute them with the transaction BEGIN; and COMMIT;
  How can I handle transaction with preparedStatement?</p>