Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdbc excuteQuery gives null

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sanket Akre
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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())
{
.
.

}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic