This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes jdbc excuteQuery gives null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc excuteQuery gives null" Watch "jdbc excuteQuery gives null" New topic

jdbc excuteQuery gives null

sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1073
here is my jdbc query

it gives null.Actually there is no value relevant to id=2222.but it should give Resultset object.
why is that?
Rob Spoor

Joined: Oct 27, 2005
Posts: 19656

If the executeQuery method returns null you should contact the implementor, because it just shouldn't. It should give you an empty ResultSet instead, meaning will return always false.

Moving to JDBC.

How To Ask Questions How To Answer Questions
Sanket Akre

Joined: Jul 16, 2008
Posts: 15
Try this :
Statement statement = null;
ResultSet FaqResult = null;
statement = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY , ResultSet.CONCUR_READ_ONLY);
FaqResult = statement.executeQuery("SELECT * FROM FAQ WHERE faq_id=2222");


I agree. Here's the link:
subject: jdbc excuteQuery gives null
Similar Threads
resultset question
Matching a String with a certain record
cs.executeQuery() throws "Query returned no data" error
procedure return resultset
JSP standard Action element