I'm using a servlet on an Apache Tomcat server to write and read data to/from a database via JDBC. All info received is correct, but after first read/write from/to the database, the database file is getting locked. Here's a code snippet:
Class.forName("org.sqlite.JDBC");
Connection conn = DriverManager.getConnection(path);
conn.setAutoCommit(false);
Statement stat = conn.createStatement();
String req = "select * from login where username=\""+username+"\" and password=\""+password+"\"";
System.out.println(req);
ResultSet rs2 = stat.executeQuery(req);
conn.setAutoCommit(true);
System.out.println(rs2.getString("rights"));
int rights = Integer.parseInt(rs2.getString("rights"));
rs2.close();
stat.close();
conn.close();
The database file gets locked and stays accessed and locked if I close the connection.