On 12/14/18 5:12 AM, Bob M wrote:
Thanks Bryan

I have rewritten the code as follows
*********************************************
  // if we have a candidate_ID to be validated, update Prototype record with
Occurances
if (Candidate_ID_to_be_validated > 0) {
         fw.writetoFile(("we get to here - 1"), File_Name);
         // update Occurances field in the similar Prototypes record by 1
         psUpdate = conn.prepareStatement("UPDATE PROTOTYPES SET Occurances =
Occurances + 1                 WHERE Prototype_ID = ?");
         fw.writetoFile(("we get to here - 2"), File_Name);
         ps.setInt(1,Candidate_ID_to_be_validated);
         psUpdate.executeUpdate();
         // commit the above transactions
         conn.commit();
         fw.writetoFile(("Updated Prototypes record with Occurances"),
File_Name);
         fw.writetoFile(("and Occurances is : - " + (Occurances + 1)),
File_Name);
***********************************************************************
Candidate_ID_to_be_validated = 3
The last entry in the log file is "we get to here - 2"

and I get a NullPointerException error - not exactly sure which line is
creating this error

Bob M


Shouldn't you use psUpdate.setInt(1,Candidate_ID_to_be_validated);

Harm-Jan Z

Reply via email to