Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-533

Can DatabaseConfiguration turn CLOB values into a Strings before returning from getProperty(String)?

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 2.0
    • Component/s: Type conversion
    • Labels:
      None
    • Environment:

      Oracle 11gR2 database and JDBC driver

      Description

      The table I'm using for DatabaseConfiguration stores the value in a CLOB column. When the getProperty(String) method searches the table to get the values, the Oracle JDBC driver is returning them back as oracle.sql.CLOB instances.

      I also use Microsoft SQL Server and its latest JDBC drivers on a similar table where the value is in a TEXT column. I know, I need to switch the column type since it's being deprecated, but that's what it is for now. Anyways, when I get a value from that table, it returns back a String instances.

      I'm not asking us to support the Oracle-specific class, but perhaps we can add some support for the java.sql.Clob interface. Can we modify the getProperty(String) method to turn those into Strings? When they're java.sql.Clob instances, I cannot use all the nice methods that do type conversion since they don't know what to do with a java.sql.Clob instance.

      Here is a code sample that might be helpful:

      private String convertClob(Clob clobValue) {
      String strValue = null;
      try {
      int length = (int) clobValue.length();
      if (length > 0)

      { strValue = clobValue.getSubString(1, length); }

      else

      { strValue = ""; }

      } catch (SQLException e)

      { throw new ConversionException(e); }

      return strValue;
      }

        Attachments

          Activity

            People

            • Assignee:
              oheger Oliver Heger
              Reporter:
              fifalover Chris Seieroe
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: