I guess that the "s" variable is a Statement. Try closing the resources after you execute:
PreparedStatement updateStatement = connection.prepareStatement("INSERT INTO STUDENTS VALUES ('S1', 2)");
try {
updateStatement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
updateStatement.close();
}
Do this after every call to the database.