I am developing a java database application using sqlite in java. While I do INSERT and UPDATE operation, it throws sql exeption :
[SQLITE_BUSY] The database file is locked(database is locked)
Even I have closed the preparedStatement and the ResultSet in the finally clause as follows, It shows the same exeption.
try {
String sql = "Insert into cheque_log(description,pay,date,amount,profile,account_no,cross_cheque) values(?,?,?,?,?,?,?)";
pst = con.prepareStatement(sql);
pst.setString(1, txt_description.getText());
pst.setString(2, txt_pay.getText());
pst.setString(3, Date);
pst.setString(4, txt_amount.getText());
pst.setString(5, profile.getSelectedItem().toString().split("-")[0]);
pst.setString(6, profile.getSelectedItem().toString().split("-")[1]);
if (crosscheque_check.isSelected()) {
pst.setString(7, "YES");
} else {
pst.setString(7, "NO");
}
pst.execute();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
} finally {
try {
pst.close();
rs.close();
} catch (Exception e) {
}
}