Results 1 to 1 of 1
  1. #1
    Join Date
    Jul 2009
    Posts
    8

    Unanswered: DECFLOAT and BigDecimal with infinite values

    I have a table where a column is DECFLOAT(16). I need to do some basic retrieval and inserts from it using entity beans. I am using BigDecimal as the type in my entities. Everything is fine till I have records in the table where the DECFLOAT column has 'infinite' as the value in it. I get the error below:


    Code:
    Caused by: com.ibm.db2.jcc.c.SqlException: [ibm][db2][jcc][converters][604][10987] Infinity or -Infinity received for DECFLOAT(16).
    	at com.ibm.db2.jcc.c.s.eb(s.java:1712)
    	at com.ibm.db2.jcc.c.s.J(s.java:1017)
    	at com.ibm.db2.jcc.c.wf.getBigDecimal(wf.java:672)
    	at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getBigDecimal(WSJdbcResultSet.java:537)
    	at org.apache.openjpa.lib.jdbc.DelegatingResultSet.getBigDecimal(DelegatingResultSet.java:282)
    Also, looks like BigDecimal cannot be instantiated with infinity values (from Javadoc):

    Code:
    public BigDecimal(double val)
    Throws:
        NumberFormatException - if val is infinite or NaN.
    I guess my question is it possible to use BigDecimal for DB2 column of type DECFLOAT or is there some other type that needs to be used.


    Code:
    > db2level
    DB21085I  Instance "db2inst2" uses "64" bits and DB2 code release "SQL09055"
    with level identifier "06060107".
    Informational tokens are "DB2 v9.5.0.5", "s091123", "MI00316", and Fix Pack
    "5".
    Product is installed at "/opt/ibm/db2/V9.5".
    
    > db2licm -l
    Product name:                     "DB2 Enterprise Server Edition"
    License type:                     "Trial"
    Expiry date:                      "09/08/2010"
    Product identifier:               "db2ese"
    Version information:              "9.5"
    
    Product name:                     "DB2 Connect Server"
    License type:                     "Trial"
    Expiry date:                      "09/08/2010"
    Product identifier:               "db2consv"
    Version information:              "9.5"
    Last edited by raks81; 07-06-10 at 08:29.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •