3 messages in com.mysql.lists.javaPrepared Statement and Tomcat
FromSent OnAttachments
Frank Daly26 Oct 2001 08:50 
Ylan Segal26 Oct 2001 08:54 
Frank Daly26 Oct 2001 09:20 
Subject:Prepared Statement and Tomcat
From:Frank Daly (fda@cit.ie)
Date:10/26/2001 09:20:35 AM
List:com.mysql.lists.java

No. The problem is not Tomcat. I retried the code with the Acme Web Server and the same problem comes up. I've changed the table; I added a primary key based on a few fields. I did this so that I could edit the records using MysqlFront. Now, however, I get this null pointer exeception.

Any advice would be appreciated

Frank

At 09:55 26/10/01 -0600, you wrote: I really don't think the problem is tomcat, I have used extensivley with all kinds of sql stuff and it works. My guess is that there is something else in your code messing it up. Are you sure that you are passing all parameters? If they are not passed, requeset.getParameter("foo") will return a null object, which later can be causing your null pointer exeception.

Ylan.

-----Original Message----- From: Frank Daly [mailto:fda@cit.ie] Sent: Friday, October 26, 2001 9:51 AM To: ja@lists.mysql.com Subject: Prepared Statement and Tomcat

Hi

I use a prepared statement object to append records to a database. This works the first time i access the servlet containing this object and the records are appended successfully. However, the next time I access the servlet, I get an error with the message java.lang.NullPointerException. The fault occurs on the line pstmt = con.prepareStatement(sql); , pstmt being my PrepareStatement Object.

I have successfully used the same code with the acme web server although I started this particular servlet from the command line.

Has anyone got any ideas?

Thanks in advance.