Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem to get count from resultset with select count(1) like query

843859May 5 2006 — edited May 5 2006
Hi,

The snippet of code is like this ...!

preparedStatement = connection.prepareStatement("select count(1) as count from acf_users where acf_user_name like ? and acf_user_password like ?");
preparedStatement.setString(1,stringUsername);
preparedStatement.setString(2,stringPassword);
resultSet = preparedStatement.executeQuery() ;
System.out.println("The ResultSet Count checkUser() : "+resultSet.getString("count"));
preparedStatement.close();

But there is a SQLException like :

java.sql.SQLException: ResultSet.next was not called

I want to extract and check the count in the program..

Does anyone has the solution, comments on this.

Thanks in Advance,

-Sachin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 2 2006
Added on May 5 2006
1 comment
447 views