db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: java.sql.SQLDataException: The resulting value is outside the range for the data type DOUBLE.
Date Mon, 28 Jan 2008 13:52:44 GMT
Hi Hong,

The max and min values of the Derby double datatype are not the max and 
min values of the Java double type. The Derby behavior is documented in 
the Derby Reference Guide in the section titled "DOUBLE PRECISION data 
type". Here's what that section says:

"DOUBLE value ranges:

    * Smallest DOUBLE value: -1.79769E+308
    * Largest DOUBLE value: 1.79769E+308
    * Smallest positive DOUBLE value: 2.225E-307
    * Largest negative DOUBLE value: -2.225E-307

These limits are different from the java.lang.DoubleJava type limits."

Hope this helps,
-Rick

Hong Ji wrote:
> When inserting a record with a DOUBLE field and value 
> Double.MAX_VALUE, it generates the exception \:
>
> java.sql.SQLDataException: The resulting value is outside the range 
> for the data type DOUBLE.
>         at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>         at 
> org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
>         at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source)
>         at 
> org.apache.derby.impl.jdbc.EmbedResultSet.noStateChangeException(Unknown 
> Source)
>         at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.setDouble(Unknown 
> Source)
>         ...
>
> Not all the DOUBLE fields fail with value Double.MAX_VALUE.
>
> I googled it and similar issue was mentioned years. Not sure, if it is 
> still a bug?
> We are using Derby 10.3.1.4 <http://10.3.1.4>.
>
> Regards,
> Hong


Mime
View raw message