aspose file tools*
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 Spring in Action this week in the Spring 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: 42286
    
  64
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: 42286
    
  64
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..





 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Got Nullpointer Exception