Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6510615

JDBC-ODBC implementation of ResultSet.close() violate specification

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Future Project
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0"
      Java(TM) SE Runtime Environment (build 1.6.0-b105)
      Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.2600]


      A DESCRIPTION OF THE PROBLEM :
      Javadoc for ResultSet.close() said "Calling the method close on a ResultSet object that is already closed is a no-op."

      http://java.sun.com/javase/6/docs/api/java/sql/ResultSet.html#close()

      However, calling it twice in a ResultSet implemented by the JDBC-ODBC bridge cause a "SQLException" on the second call.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the following program. This program use the EPSG database (freely downloadable at http://www.epsg.org/Geodetic.html) as a test, registered un the "ODBC source" control panel under the name "EPSG". But any database should fit for the test.

      ACTUAL -
      The stack trace below.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.sql.SQLException: ResultSet is closed
              at sun.jdbc.odbc.JdbcOdbcResultSet.checkOpen(JdbcOdbcResultSet.java:6650)
              at sun.jdbc.odbc.JdbcOdbcResultSet.clearWarnings(JdbcOdbcResultSet.java:1767)
              at sun.jdbc.odbc.JdbcOdbcResultSet.close(JdbcOdbcResultSet.java:1470)
              at Test.main(Test.java:11)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.sql.*;

      public class Test {
          public static void main(String[] args) throws Exception {
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection c = DriverManager.getConnection("jdbc:odbc:EPSG");
              try {
                  Statement s = c.createStatement();
                  ResultSet r = s.executeQuery("SELECT * FROM Alias");
                  r.close();
                  r.close(); // Crash here
              } finally {
                  c.close();
              }
          }
      }

      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            Assignee:
            lancea Lance Andersen
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: