File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
JDBC and Relational Databases
jdbc excuteQuery gives null
Joined: Nov 25, 2008
Jun 24, 2009 00:03:40
here is my
ResultSet FaqResult=statement.executeQuery("SELECT * FROM FAQ WHERE faq_id=2222");
it gives null.Actually there is no value relevant to id=2222.but it should give Resultset object.
why is that?
Joined: Oct 27, 2005
Jun 24, 2009 02:02:09
If the executeQuery method returns null you should contact the implementor, because it just shouldn't. It should give you an empty
instead, meaning rs.next() will return always false.
Moving to JDBC.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Joined: Jul 16, 2008
Jun 24, 2009 02:14:23
Try this :
Statement statement = null;
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
Matching a String with a certain record
cs.executeQuery() throws "Query returned no data" error
procedure return resultset
JSP standard Action element
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015