Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6924467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:40:01+00:00 2026-05-27T10:40:01+00:00

I have a problem with my JDBC code. This is the relevant code: /**

  • 0

I have a problem with my JDBC code. This is the relevant code:

/** 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 (!committed) conn.rollback();
    }
  }
  finally {               
    conn.close();
  }       
  return storedPassword;
}

This is the exception:

java.sql.SQLException: Exhausted Resultset
    oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:1270)
    oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494)
    org.jboss.jca.adapters.jdbc.WrappedResultSet.getString(WrappedResultSet.java:1359)
    com.dx.sr_57.user_check.CheckUserDB(user_check.java:100)
    com.dx.sr_57.user_check.user_compare(user_check.java:123)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:601)
    org.apache.el.parser.AstValue.invoke(AstValue.java:196)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

How is this caused and how can I solve it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:40:01+00:00Added an answer on May 27, 2026 at 10:40 am
    result.next();
    
    storedPassword = result.getString("passwd"); 
    

    You are not checking the return value of next. If you have no rows you get into trouble…

    if(result.next()){
       storedPassword = result.getString("passwd");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner with jdbc ... I have a problem running this code :
I have JDBC code which inserts into a database table by executing a PreparedStatement.
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have this new challenge to load ~100M rows from an Oracle database and
I have a slightly unique requirement with the Java-JDBC API along with Oracle Database.
I have a problem during an insert in Oracle using Java and JDBC. The
I have a java app + SQL server database. DB operation use JDBC with
I have a problem in JDBC driver for SQLite. I am executing a query
I have a problem using iBatis as database framework for a web application. I
I have a problem with a really slow connection between my Java code and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.