The following is happening in a DB2/WebSphere setup, but I think the problem would occur even if run as standalone app with JDBC, therefore I am posting this in this forum.
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 'infinity' as the value in it. I get the error below:
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1037][12307][3.57.110] Exception occurred during DECFLOAT conversion. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.db2.jcc.am.bd.a(bd.java:660)
at com.ibm.db2.jcc.am.bd.a(bd.java:60)
at com.ibm.db2.jcc.am.bd.a(bd.java:85)
at com.ibm.db2.jcc.am.gc.h(gc.java:1972)
at com.ibm.db2.jcc.am.gc.W(gc.java:1959)
at com.ibm.db2.jcc.am.gc.E(gc.java:1143)
at com.ibm.db2.jcc.am.am.getBigDecimal(am.java:883)
at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getBigDecimal(WSJdbcResultSet.java:537)
at org.apache.openjpa.lib.jdbc.DelegatingResultSet.getBigDecimal(DelegatingResultSet.java:282)
Caused by: com.ibm.db2.jcc.a.a: [jcc][converters][604][10987]Infinity or -Infinity received for DECFLOAT(16).
at com.ibm.db2.jcc.a.d.o(d.java:668)
at com.ibm.db2.jcc.am.gc.h(gc.java:1966)
Also, looks like BigDecimal cannot be instantiated with infinity values (from Javadoc):
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 (if there are 'infinity' as values in table?