title: Invalid operation for read only resultset when using select for update nowait in multithreaded environment
body: <p>For an Oracle database, the following program will throw SQL exceptions only for some threads. Why downgrading resultSetConcurrency from <code>CONCUR_UPDATABLE to CONCUR_READ_ONLY</code>? In a single thread environment this is not happening.</p>
  
  <pre><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.sql.SQLException;
  
  
  public class Main extends Thread {
  
      public static final String DBURL = "jdbc:oracle:thin:@localhost:1521:DB";
      public static final String DBUSER = "USER";
      public static final String DBPASS = "PASS";
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          for(int i=0; i&lt;20; i++)
              new Main().start();
      }
  
      @Override
      public void run() {
  
          try
          {
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
  
              Connection con = DriverManager.getConnection(DBURL, DBUSER, DBPASS);
              con.setAutoCommit(false);
  
              try(PreparedStatement pstmt = con.prepareStatement("SELECT COLUMN1 FROM TABLE1 FOR UPDATE NOWAIT", 
                      ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE))
              {               
                  ResultSet rs = pstmt.executeQuery();
  
                  if (rs.next()) {
                      rs.updateString(1, "12345");
                      rs.updateRow();
                  }            
              }
              finally
              {
                  con.commit();
                  con.close();
              }
          }
          catch(SQLException e)
          {
              if(!e.toString().contains("NOWAIT"))
                  e.printStackTrace();
          }
      }
  
  }
  </code></pre>
  
  <p></p>