aspose file tools*
The moose likes JDBC and the fly likes NullPointerException on INSERT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "NullPointerException on INSERT" Watch "NullPointerException on INSERT" New topic
Author

NullPointerException on INSERT

Bob Backlund
Ranch Hand

Joined: Jun 05, 2003
Posts: 51
Hi I'm pretty new to the whole SQL/Java thing, I'm trying to right a simple JSP/Servlet site. (well I thought it'd be simple)
Simply the user can enter some data into a set of fields on a JSP, this is then passed through a Sevler to another JSP. The Servlet is getting the data from the fields (I have System.out to show the data values) but the insert is failing with a java.lang.NullPointerException expection, even though all fields have a value in them and could accept a NULL value anyway.
The only thing I can think of, is i have a 'ID' field which is currently being left blank, however like i said it can have a NULL value so I don't think this should be a problem.
KPS


Cheers!
Nagendra Prasad
Ranch Hand

Joined: Jul 11, 2002
Posts: 219
Are you sure it is the insert that is throwing the NullPointerException? Are you sure it is not somewhere else in the code?
Best would be to inspect the stack trace? or post it here... I can take a look and offer my 2 pence worth of advice.


Best Regards,<br />Nagendra Prasad.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30764
    
156

Are you by any chance trying to do this?

This is a commonly used invalid way of inserting null.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: NullPointerException on INSERT