I couldn't figure out what's the problem with the following code... anybody
could kindly help with this? Thanks!
the problem always happens when the second time I call
pstmt.executeUpdate()...
try {
PreparedStatement pstmt = con.prepareStatement(stmt);
for (int i = 0; i < 7; i++) {
if (hours[i] != 0) {
// some unrelevant code here...
pstmt.clearParameters();
pstmt.setDate(1, Date.valueOf(str_day));
pstmt.setFloat(2, hours[i]);
pstmt.executeUpdate();
} // end of if (hours[i] != 0)
} // end of for loop
pstmt.close();
con.commit();
}
catch (SQLException e) {
log("Exception while updating time_mst: " + e.getMessage());
con.rollback();
throw e;
}
The error messages I got are as follows:
Error: 500
Internal Servlet Error:
java.lang.NullPointerException
at javax.servlet.GenericServlet.getServletContext(Compiled Code)
at javax.servlet.GenericServlet.log(Compiled Code)
at DBConPool.insertTimeDet(Compiled Code)
_______________________________________________________________
Get Free Email and Do More On The Web. Visit http://www.msn.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html