• Post Reply Bookmark Topic Watch Topic
  • New Topic

jdbc excuteQuery gives null  RSS feed

 
Ranch Hand
Posts: 1275
  • 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?
 
Sheriff
Posts: 21182
87
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.
 
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
Boost this thread!