If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DECFLOAT and BigDecimal with infinite values

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-06-10, 07:25
raks81 raks81 is offline
Registered User
 
Join Date: Jul 2009
Posts: 8
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 07:29.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On