title: ADO.NET, Closing an OracleConnection without prior Commit or Rollback: Will it leak?
body: <p>Suppose I am doing the following:</p>
  
  <pre><code>using (OracleConnection conn = new OracleConnection(connStr))
  {
      OracleTransaction trans = conn.BeginTransaction();
      OracleCommand command = new OracleCommand(cmdTxt, conn, trans);
      // this statement is executed in a transaction context:
      command.ExecuteNonQuery();
  }
  // the using statement will dispose and thus close the connection.
  // a rollback is done implicitly
  </code></pre>
  
  <p>Although I did not executed <code>transaction.Rollback()</code>, my tests showed that a rollback is done implicitly.</p>
  
  <p>My question is: Will this code leak connections or anything else?</p>
  
  <p>Edit1: I am the <code>System.Data.OracleClient</code> namespace.</p>
  
  <p>Edit2: This is a contrieved example code. The more realistic scenario is when within the using statement an exception occures and the <code>Commit()</code> statement is not executed yet.</p>
  
  <p>Edit3: From the answer I think that this is favorable:</p>
  
  <pre><code>using (OracleConnection conn = new OracleConnection(connStr))
  using (OracleTransaction trans = conn.BeginTransaction())
  using (OracleCommand command = new OracleCommand(cmdTxt, conn, trans))
  {
      command.ExecuteNonQuery();
      trans.Commit();
  }
  </code></pre>
  
  <p>Should cleanly dispose anything and make clear what is happening.</p>