Hi All!
Another DB greenhorn query.
I've got this method that works fine retrieving an entry from a table, when the enry actually exists.
If I try retrieving, say "Bob" if bob doesn't exist, it doesn't throw any sort of exception. Do SQL exceptions have to be declared or caught for the program to cough up a warning when something goes wrong?
Thank you in andvance.
public void retrieveStudent(Connection c,
String studentName)
throws IOException
{
// r is ResultSet defined for the entire class
this.r = null;
try{
Statement s = null;
s = c.createStatement();
this.r = s.executeQuery(
" SELECT student_ID, name, student_psw FROM Student WHERE name = '" + studentName + "'");
//s.close();
}
catch(Exception e){
System.out.println("PROBLEM WITH STUDENT: " + e);
e.printStackTrace();
}
}
