I have a class that interacts with the McKoi DB: saves, retrieves and
deletes rows from.
I've tested the saving part: works fine without a problem.
Problem show's up when I try RETRIEVE (print to screen) DELETE a wor
and
RETRIEVE again. What was ment to
get deleted still shows up. It disapears from the display however the
second
time i cycle through the program.
I'm utilizing connection pooling code from Javaexchange.com, keeping 6
connections in the pool (if that could eve be relevant to the case).
HERE'S RETRIEVING PART:
public ResultSet retrieveAllStudents(){
ResultSet result2 = null;
Statement s2 = null;
try{
Connection c = myBroker.getConnection();
s2 = c.createStatement();
result2 = s2.executeQuery(
" SELECT student_ID, name, student_psw FROM Student"
);
myBroker.freeConnection(c);
}
catch(Exception e2){}
return result2;
}
HERE'S THE DELETING PART:
public void deleteStudent(
String studentName){
Statement s3 = null;
try{
Connection c = myBroker.getConnection();
s3 = c.createStatement();
s3.executeQuery(
"DELETE FROM Student WHERE name = '" + studentName +"'"
);
myBroker.freeConnection(c);
}
catch(Exception e7){}
}
so, I've tested deleteStudent() by itself and it deletes fine.
Somehow when I call RETRIEVE DELETE RETRIEVE the changes don't show
up on
the second RETRIEVE.
I'm using NetBeans 3.6 for it