title: Lock table in oracle database using JDBC driver
body: <p>I am trying to lock a table in my testing framework in order to trigger timeouts.  I am using the following code to lock the table.</p>
  
  <pre><code>String lock = "lock table "+ tableName +" in exclusive mode";
  try {
          connection = DriverManager.getConnection(_url, _username, _password);
          connection.setAutoCommit(false);  
          Statement stmt1=connection.createStatement();  
          stmt1.executeUpdate(lock);  
  
      } catch (SQLException e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>After I have executed this I try to access the page and add an element to the account.  However it doesn't work, the lock doesn't seem to have occurred.  Any idea why this wouldn't work?  I am currently testing this in java and once I have executed that lock I am sleeping the thread while manually testing the page, could this be causing problems?</p>
  
  <p>Thanks,
  James</p>