This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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.