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

Provide JDBC metadata for character sorting

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.2.0
    • core-libs
    • generic
    • generic



      Name: krT82822 Date: 08/05/99


      In JDBC, there is no way to determine the manner in which an ORDER BY clause (executed by the underlying driver or database) is sorting character data. Consider the following possibilities:

      - character fields ordered by simple ordinal values (each Unicode character is sorted based on its 16-bit unsigned integer value)
      - character sets
      - locale settings

      Since the implementation is database- or driver-specific, the application program should at least be able to determine (if not set) the sort order being used.

      1) The java.sql.DatabaseMetaData getColumns method does not provide either case sensitivity or collation information for character columns;
      2) The java.sql.ResultSetMetaData does not provide collation information for character columns.

      The driver should be able to express the ordering either as Unicode ordinal or in terms of a java.text.Collator (or at least the Collator attributes: Locale, Decomposition, and Strength).

      Suggestions:
      1) Add a column to the ResultSet returned from the java.sql.DatabaseMetaData getColumns method that specifies the case sensitivity of the column;
      2) Add getDefaultCaseSensitiveCollator() and getDefaultCaseInsensitiveCollator() to java.sql.DatabaseMetaData;
      3) Add getCollator(int column) to java.sql.ResultSetMetaData.

      If being able to set the Collator is important, I would suggest replacing #2 above with:
      2) Add getCaseSensitiveCollator(), setCaseSensitiveCollator(collator), getCaseInsensitiveCollator(), and setCaseInsensitiveCollator(collator) to java.sql.Connection.

      A potential concern with being able to set the Collator is that it could require sorting to be moved out of the database, potentially moving that work to the client machine.
      (Review ID: 93402)
      ======================================================================

            jellissunw Jon Ellis (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: