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
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: 39547
    
  27
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 - updated with new look and Ping home screen widget
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: 39547
    
  27
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
throwing an Exception after first exceution ..
errors uploading an image to the database
Problem with the query in JDBC ,resultset empty
Run Time Error
SQLException : not all variables bound