我收到错误java.sql.SQLException:Exhausted ResultSet运行对Oracle数据库的查询.连接是通过Websphere中定义的连接池实现的.执行的代码如下:
if (rs! = null) (
while (rs.next ()) (
count = rs.getInt (1);
)
)
Run Code Online (Sandbox Code Playgroud)
我注意到结果集包含数据(rs.next())
谢谢
我的JDBC代码有问题.这是相关代码:
/** method for checking password into the Oracle database */
public String CheckUserDB(String userToCheck) throws SQLException {
String storedPassword;
if (ds == null) throw new SQLException("No data source");
Connection conn = ds.getConnection();
if (conn == null) throw new SQLException("No connection");
try {
conn.setAutoCommit(false);
boolean committed = false;
try {
PreparedStatement passwordQuery = conn.prepareStatement(
"SELECT passwd from USERS WHERE userz = ?");
passwordQuery.setString(1, userToCheck);
ResultSet result = passwordQuery.executeQuery();
result.next();
storedPassword = result.getString("passwd");
conn.commit();
committed = true;
} finally {
if …Run Code Online (Sandbox Code Playgroud)