File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Soft Skills this week in the Jobs Discussion 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: 42907
    
  69
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".
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: 42907
    
  69
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