Been at this for months and I cant understand why this is happening. I have tried several drivers and I keep getting strange errors and I was hoping someone could help me out. I am trying to develop a applet-servlet-sql connection. I have placed all the classes in a Domino 4.6.7 server the code im using works in Tomcat. I have placed streams throughout the program to catch errors. So when i do the following in the init() Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); myCon = DriverManager.getConnection ("jdbc:microsoft:sqlserver://9188.8.131.52:9999;DatabaseName=x;User=x;Password=x"); no errors are thrown. But when I do the following further in the program in the performTask() PreparedStatement statement = myCon.prepareStatement( "INSERT INTO login ([First_Name]) VALUES (?)"); java.lang.NullPointerException: at t.ServeTwoServlet.performTask(ServeTwoServlet.java:101) at t.ServeTwoServlet.doPost(ServeTwoServlet.java:31) at javax.servlet.http.HttpServlet.service(HttpServlet.java:278) at javax.servlet.http.HttpServlet.service(HttpServlet.java:330) at COM.lotus.go.internal.InternalServletThread.run(InternalServletInvoker.java:396) at COM.lotus.go.internal.InternalServletInvoker.executeServlet(InternalServletInvoker.java:280) at COM.lotus.go.internal.InternalServletInvoker.service(InternalServletInvoker.java:202) at COM.lotus.go.internal.ServletManager.service(ServletManager.java:453)
at the point where the code is throwing the error, the connection must have been reset to null(or never set at all). Don't have the rest of your code, so it's hard to help you with that kind of error( if it's not too long, post it ).
Hey John where is the myCon object declared. Is it in that method, or outside where the performTask method has visibility of that object. The reason we say this is because it is easy to see that at that last line the myCon variable is set to null. Mark