title: How do I lock database records from Java?
body: <p>I'm developing a database program in Java with dbf.  I need to know how to lock the database records from the Java side.  </p>
  
  <p>Example: we have a database table <code>cheques</code> with 5 records in the table (<code>record 1</code> through <code>5</code>).  There are 2 users, <code>user-1</code> and <code>user-2</code>. <code>user-1</code> accesses <code>record 1</code> and <code>user-2</code> tries to access <code>record 1</code> at the same time.  I want to lock <code>record 1</code> to prevent access to that record by <code>user-2</code> while <code>user-1</code> is accessing it. How do I do this in Java?</p>