Please I have an issue. I created a GUI application using java and I am presently using SQLite as my database.
The application was running fine at first but presently I keep getting this error
java.sql.SQLException: [SQLITE_BUSY] The database file is locked (database is locked)
Jul 18, 2021 8:53:43 PM db.LecturalQueries addLectural
SEVERE: null
java.sql.SQLException: [SQLITE_BUSY] The database file is locked (database is locked)
at org.sqlite.core.DB.newSQLException(DB.java:890)
at org.sqlite.core.DB.newSQLException(DB.java:901)
at org.sqlite.core.DB.execute(DB.java:807)
at org.sqlite.jdbc3.JDBC3PreparedStatement.execute(JDBC3PreparedStatement.java:50)
at db.LecturalQueries.addLectural(LecturalQueries.java:46)
at studentmanagmentsystem.AddLectural.AddbtnActionPerformed(AddLectural.java:367)
//the code to handle adding a new Lecturals
public void addLectural(String[] details){
try {
// the insert statment
String sql = "insert into Lecturals"
+"(LecturalName,CourseID,Email,Password)"
+"values(?,?,?,?)";
// loading the statement into the connection so it can be executed
pst = con.prepareStatement(sql);
//passing in the values
pst.setString(1, details[0]);
pst.setInt(2, Integer.parseInt(details[1]));
pst.setString(3, details[2]);
pst.setString(4, details[3]);
//executing the query
pst.execute();
//popping up a sccess message
JOptionPane.showMessageDialog(null, "Lectural Added Successfully!");
} catch (SQLException ex) {
System.out.println(ex);
Logger.getLogger(CoursesQueries.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, "Error while adding Lectural");
}
}
I created the connections and the lecture queries on a different package and called it to the Jform GUI using the appropriate object names, I just can't find the issue. Also, I tried closing the connection but when I did this it still did not work.
Before getting to this Added interface I had a login page and some other connections which I also closed but still got the error message.