wood burning stoves 2.0*
The moose likes JDBC and the fly likes  Got Nullpointer Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark " Got Nullpointer Exception" Watch " Got Nullpointer Exception" New topic
Author

Got Nullpointer Exception

shiva mistry
Greenhorn

Joined: Feb 05, 2013
Posts: 10
When I try to insert student in Database I got an exception like Nullpointer Exception can any one help please ?






Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41089
    
  44
In which line of code are you getting the exception? Post the entire stack trace.

Have you verified that "con" is not null? You didn't post code that assigns a value to "con".


Ping & DNS - my free Android networking tools app
shiva mistry
Greenhorn

Joined: Feb 05, 2013
Posts: 10
Ulf Dittmer wrote:In which line of code are you getting the exception? Post the entire stack trace.

Have you verified that "con" is not null? You didn't post code that assigns a value to "con".



Here is that code : I am getting an Exception at line 28

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41089
    
  44
So it's probably "con" that's null - that means you probably got a stack trace in line 18; correct?
shiva mistry
Greenhorn

Joined: Feb 05, 2013
Posts: 10
Ulf Dittmer wrote:So it's probably "con" that's null - that means you probably got a stack trace in line 18; correct?


Hi Ulf, I forgot to define con in default constructor now it's working Thanks..





 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Got Nullpointer Exception
 
Similar Threads
Problem with the query in JDBC ,resultset empty
throwing an Exception after first exceution ..
Run Time Error
SQLException : not all variables bound
errors uploading an image to the database