This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Null Pointer Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Null Pointer Exception " Watch "Null Pointer Exception " New topic

Null Pointer Exception

Krishna Kodali

Joined: Feb 03, 2011
Posts: 1
This program compiled but i am getting runtime null pointer exception.

Please let me know if i am doing any thing wrong.

Exception in thread "main" java.lang.NullPointerException
at JDBCExample.main(
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63208

Hmmm, I'm trying to look at your code, but the stubborn forum software has made it look all wonky. If you use CODE tags when posting code to the forums (see the FAQ at ⇒ UseCodeTags ⇐) they tell it "Hey! Keep your hands off my formatting!" and your code will look just like when you cut and pasted it into the reply. Cool, no?

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

The error message tells you that the NullPointerException happens at line 30. Which line is this referring to ?

Also, although you check if "conn" is not null, you don't do anything in case "conn" is null.

[My Blog]
All roads lead to JavaRanch
Have you checked out Aspose?
subject: Null Pointer Exception
jQuery in Action, 3rd edition