3 Replies Latest reply on Jun 16, 2011 3:32 PM by 796440

    JDBC: ResultSet


      I am writing a java file which is pulling values from a table in my database.

      I need to take the count that how many row are pulled into the resultset.

      For that reason I am using the following logic
         rs = stmt.executeQuery("select col1,col2 from tab where ...");
         int rsCount = rs.getRow();
      I checked the query in java, it is returning the required fields in the resultset.

      I am getting the error at 'rs.last()'.
      When i debug the code at this line I get the following message:
      The JAR file C:\ORACLE_HOME\jdbc\lib\ojdbc5.jar has no source attachment.

      I have added the the ojdbc5.jar and orai18n.jar into my classpaths.
      I am using Oracle

      Please help me out. I am also trying my best to solve this problem...

      Thank You,
        • 1. Re: JDBC: ResultSet
          "The JAR file C:\ORACLE_HOME\jdbc\lib\ojdbc5.jar has no source attachment." is not the real error. Thats just your IDE telling you that it has no source files available for a class it is trying to step into, so it cannot show that source code.

          Any error in Java is exposed as an exception being thrown. Look into Java exception handling to learn how to do proper error handling.
          1 person found this helpful
          • 2. Re: JDBC: ResultSet

            Thank You,
            • 3. Re: JDBC: ResultSet
              Vaib-acle wrote:
              I am getting the error at 'rs.last()'.
              1. If you're getting an error, isn't it obvious to you that you should paste in the exact, complete error message? Or did you think that there's only one kind of error that can possibly occur?

              2. Since you haven't provided any details, I'm just going to take a wild guess that you don't have a scrollable ResultSet. Did you actually read the docs for last() closely? Including the list of exceptions thrown and under what circumstances?