This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
you were right about that. Know i have in a other oage same sql error.Null pointer exception my code is: <%@ page contentType="text/html; charset=windows-1253" language="java" import="java.text.*,java.sql.*,java.util.*,javax.servlet.*,javax.servlet.http.*" %> <html>
Aris, Do you know what line the NullPointer is being thrown on?
I suspect there is a problem obtaining the connection. The code currently logs the exception and then continues with a null connection. You could test this theory, but putting everything in the try/catch block or by looking at the log.
Two other comments: 1) It is good practice to close the connection in a finally block. That way the connection is closed even if an exception is thrown. This allows the driver/database to better recover resources. 2) In a production application, it is good practice to keep code out of the JSP. Especially JDBC code. This makes the code easier to maintain.