title: SQLITE Database is locked in java (IDE NetBeans)
body: <p>When I perform any action it works in database but suddenly it shows an error of Database is Locked!</p>
  
  <p>Suppose this is the actionPerformed on one button:</p>
  
  <pre><code>private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {       
  //Sahil_Computers.ConnecrDb(); is the database connecting method!                                  
      conn = Sahil_Computers.ConnecrDb();
      try{
        String sql = "insert into dailyExp (Sr,Description,Amount) values (?,?,?)";
        pst = conn.prepareStatement(sql);
        pst.setString(1, txt_srE.getText());
        pst.setString(2, txt_desE.getText());
        pst.setString(3, txt_rsE.getText());
  
        pst.execute();
        JOptionPane.showMessageDialog(null, "Saved!");
      }catch(Exception e){
          JOptionPane.showMessageDialog(null, e);
      }finally{
      try{
          rs.close();
          pst.close();
      }catch(Exception e){
          JOptionPane.showMessageDialog(null, e);
      }
  }    
    update_table_exp();
  }
  </code></pre>
  
  <p>and then again when I try to perform another action just like:</p>
  
  <pre><code>private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
      conn = Sahil_Computers.ConnecrDb();
      String sql = "delete from dailySale where Sr=?";
      try{
          pst = conn.prepareStatement(sql);
          pst.setString(1, txt_sr1.getText());
          pst.execute();
          JOptionPane.showMessageDialog(null, "Deleted!");
      }catch(Exception e){
          JOptionPane.showMessageDialog(null, e);
      }finally{
      try{
          rs.close();
          pst.close();
      }catch(Exception e){
          JOptionPane.showMessageDialog(null, e);
      }
  }    
    update_table_sale();
  }
  </code></pre>
  
  <p>or action like this one:</p>
  
  <pre><code>private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {                                         
      conn = Sahil_Computers.ConnecrDb();
      try{
          String sum = null, sub= null;
          String subto = null;
          int sum1, sub1, subto1;
          String sql = "select sum(Debit) from dailySale";
          pst=conn.prepareStatement(sql);
          rs=pst.executeQuery();
          if(rs.next()){
              sum = rs.getString("sum(Debit)");
              txt_tsale.setText(sum);
          }
          sql = "select sum(Amount) from dailyExp";
          pst=conn.prepareStatement(sql);
          rs=pst.executeQuery();
          if(rs.next()){
              sub = rs.getString("sum(Amount)");
              txt_texp.setText(sub);
          }
          sum1 = Integer.parseInt(sum);
          sub1 = Integer.parseInt(sub);
          subto1 = sum1 - sub1;
          subto = Integer.toString(subto1);
          txt_tsub.setText(subto);
      }catch(Exception e){
          JOptionPane.showMessageDialog(null, e);
      }finally{
      try{
          rs.close();
          pst.close();
      }catch(Exception e){
          JOptionPane.showMessageDialog(null, e);
      }}}
  </code></pre>
  
  <p>Then it shows database is locked!</p>