3 Replies Latest reply: Jun 16, 2011 10:32 AM by 796440 RSS

    JDBC: ResultSet

    854103
      Hello:)

      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 ...");
         rs.last();
         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 11.1.2.1.

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

      Thank You,
      Vaib:)
        • 1. Re: JDBC: ResultSet
          gimbal2
          "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.
          • 2. Re: JDBC: ResultSet
            854103
            ok:)

            Thank You,
            Vaib:)
            • 3. Re: JDBC: ResultSet
              796440
              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?