wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc excuteQuery gives null" Watch "jdbc excuteQuery gives null" New topic
Author

jdbc excuteQuery gives null

sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1069
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
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

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 rs.next() will return always false.

Moving to JDBC.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Sanket Akre
Greenhorn

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");

while(FaqResult.next())
{
.
.

}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
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