IBM Support

LI73949: JDBC API RESULTSET.GETSTRING() RETURNS DIFFERENT FORMATS FOR BIGDECIMAL NUMERIC VALUE BETWEEN JDK 1.4 AND JDK 1.5.

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Add a new ability to getString on a BigDecimal in JDK 1.5 that
    corresponds to JDK 1.4 getString, due to changes made within the
    JDK.
    
    One example of the difference is:
    
    In JDK 1.4.2, resultset.getString() returns
    0.00000000000000000000000000
    
    In JDK 1.5.0, resultset.getString() returns 0E-26
    
    A new datasource/URL property has been introduced, whereby a
    getString can return the Java 1.4 behavior of non exponent
    format for a BigDecimal column with JDK 1.5. The default driver
    behavior will still be to return the BigDecimal in exponent
    format with JDK 1.5.
    
    The possible values are:
    
    0 - (DECIMAL_STRING_FORMAT_NOT_SET) If not explicitly set, or if
    explicitly set to 0, the default value will be 0 that has the
    semantics of setting this value to
    DECIMAL_STRING_FORMAT_TO_STRING.
    
    1 - (DECIMAL_STRING_FORMAT_TO_STRING): If set to 1,
    getString on this BigDecimal column will be returned
    in whatever format java.math.BigDecimal.toString()
    method returns.
    
    2 - (DECIMAL_STRING_FORMAT_TO_PLAIN_STRING): If set to 2,
    getString on this BigDecimal column will be returned
    in whatever format java.math.BigDecimal.toPlainString()
    method returns.
    
    The method to set this value on a datasource is
    setDecimalStringFormat(int).  Here is an example of how to set
    on a datasource.
    
    com.ibm.db2.jcc.DB2SimpleDataSource ds = new
    com.ibm.db2.jcc.DB2SimpleDataSource();
    ds.setDecimalStringFormat(2);
    
    In URL it can be set with the property name
    "decimalStringFormat"
    
    Here is an example of how to set the value in a URL:
    
    url = "jdbc:db2://localhost:50000/sample:decimalStringFormat=2;"
    

Local fix

  • N/A
    

Problem summary

  • The difference is:
    
    In JDK 1.4.2, resultset.getString() returns
    0.00000000000000000000000000
    
    In JDK 1.5.0, resultset.getString() returns 0E-26
    
    A new datasource/URL property can be set to get the old behavior
    of non exponent format for a BigDecimal column with JDK 1.5. The
    default driver behavior will still be to return the BigDecimal
    in exponent format with JDK 1.5.
    
    Here is an example of how to set on a datasource.
    
    com.ibm.db2.jcc.DB2SimpleDataSource ds = new
    com.ibm.db2.jcc.DB2SimpleDataSource();
    ds.setDecimalStringFormat(1);
    
    In URL it can be set with the property name
    "decimalStringFormat"
    
    url = "jdbc:db2://localhost:50000/sample:decimalStringFormat=1;"
    

Problem conclusion

  • Problem was first fixed in Version 9.1 Fix Pack 8.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI73949

  • Reported component name

    DB2 UDE ESE LIN

  • Reported component ID

    5765F4104

  • Reported release

    910

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2008-12-10

  • Closed date

    2009-10-07

  • Last modified date

    2009-10-08

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    LI74240

Fix information

  • Fixed component name

    DB2 UDE ESE LIN

  • Fixed component ID

    5765F4104

Applicable component levels

  • R910 PSY

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"910","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
08 October 2009