title: Object Lock issue in DB using stored procedure
body: <p>I have a process which loads data from a file and then tries to insert the records in a table.</p>
  
  <p>If the file is too large, it takes a while to load all the data in the XYZ table. I am using batch to insert the records in the table.</p>
  
  <p>In the meantime, another process kicks in and tries to read data based on some condition from the XYZ table, since the 1'st process hasn't finished writing the data to the table and the 2'nd process tries to read the same data, I get an Object in use error.</p>
  
  <p>I was thinking of two options to fix this issue:</p>
  
  <ol>
  <li><p>Unless all the records are inserted by process1, keep one of the status column different, so that process2 can't retreive the records</p></li>
  <li><p>Insert the data in chunks, if something fails, have a mechanism to retry from the last record inserted (need a mechanism for this).</p></li>
  </ol>
  
  <p>I am using DB2 and plain jdbc to insert records.</p>
  
  <p>Please let me know whats the best possible way to go about for this issue</p>