You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Hong Ji <ho...@gmail.com> on 2008/01/27 02:12:48 UTC
java.sql.SQLDataException: The resulting value is outside the range for the data type DOUBLE.
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.
Regards,
Hong
Re: java.sql.SQLDataException: The resulting value is outside the
range for the data type DOUBLE.
Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Daniel John Debrunner <dj...@apache.org> writes:
> Knut Anders Hatlen wrote:
>> Hong Ji <ho...@gmail.com> writes:
>>
>>> Thanks for the replies.
>>>
>>> It will definitely help if the Java Double.MAX_VALUE and
>>> Double.MIN_VALUEare supported in Derby.
>>>
>>> Any reason why the Double.MAX_VALUE/Double.MIN_VALE are different in Derby
>>> and Java?
>>
>> According to the comments in the code, this is a limitation that was
>> introduced for compatibility with DB2. Being compatible with DB2 is no
>> longer a requirement for Derby, so if it's not causing any backward
>> compatibility issues and someone signs up for DERBY-3290, there's
>> nothing stopping us from lifting the restriction.
>
> DERBY-3290 is a different issue, that's for adding support for
> non-numeric values to DOUBLE such as Double.Nan, which is believed to
> be against the SQL standard. Extending the range to match the java
> range should be a separate issue.
Ah, sorry, I read [POSITIVE|NEGATIVE]_INFINITY in the summary as
[MIN|MAX]_VALUE. I agree that it should be logged as a separate
issue. (It isn't logged, is it?)
--
Knut Anders
Re: java.sql.SQLDataException: The resulting value is outside the
range for the data type DOUBLE.
Posted by Daniel John Debrunner <dj...@apache.org>.
Knut Anders Hatlen wrote:
> Hong Ji <ho...@gmail.com> writes:
>
>> Thanks for the replies.
>>
>> It will definitely help if the Java Double.MAX_VALUE and
>> Double.MIN_VALUEare supported in Derby.
>>
>> Any reason why the Double.MAX_VALUE/Double.MIN_VALE are different in Derby
>> and Java?
>
> According to the comments in the code, this is a limitation that was
> introduced for compatibility with DB2. Being compatible with DB2 is no
> longer a requirement for Derby, so if it's not causing any backward
> compatibility issues and someone signs up for DERBY-3290, there's
> nothing stopping us from lifting the restriction.
DERBY-3290 is a different issue, that's for adding support for
non-numeric values to DOUBLE such as Double.Nan, which is believed to be
against the SQL standard. Extending the range to match the java range
should be a separate issue.
Dan.
Re: java.sql.SQLDataException: The resulting value is outside the
range for the data type DOUBLE.
Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Hong Ji <ho...@gmail.com> writes:
> Thanks for the replies.
>
> It will definitely help if the Java Double.MAX_VALUE and
> Double.MIN_VALUEare supported in Derby.
>
> Any reason why the Double.MAX_VALUE/Double.MIN_VALE are different in Derby
> and Java?
According to the comments in the code, this is a limitation that was
introduced for compatibility with DB2. Being compatible with DB2 is no
longer a requirement for Derby, so if it's not causing any backward
compatibility issues and someone signs up for DERBY-3290, there's
nothing stopping us from lifting the restriction.
--
Knut Anders
Re: java.sql.SQLDataException: The resulting value is outside the range for the data type DOUBLE.
Posted by Hong Ji <ho...@gmail.com>.
Thanks for the replies.
It will definitely help if the Java Double.MAX_VALUE and
Double.MIN_VALUEare supported in Derby.
Any reason why the Double.MAX_VALUE/Double.MIN_VALE are different in Derby
and Java?
Hong
On Jan 28, 2008 6:50 AM, Thomas Nielsen <Th...@sun.com> wrote:
> Mark Thornton wrote:
> > The more interesting question is whether those limits should remain
> > different or should they be brought into alignment with Java Double
> > (and add +-infinite and NaN as well).
> It would probably be good to fully support the java Double datatype, but
> see DERBY-3290 for some consderations on Double.NaN and
> Double.POSITIVE|NEGATIVE_INFINITY.
>
> Thomas
>
Re: java.sql.SQLDataException: The resulting value is outside the
range for the data type DOUBLE.
Posted by Thomas Nielsen <Th...@Sun.COM>.
Mark Thornton wrote:
> The more interesting question is whether those limits should remain
> different or should they be brought into alignment with Java Double
> (and add +-infinite and NaN as well).
It would probably be good to fully support the java Double datatype, but
see DERBY-3290 for some consderations on Double.NaN and
Double.POSITIVE|NEGATIVE_INFINITY.
Thomas
Re: java.sql.SQLDataException: The resulting value is outside the
range for the data type DOUBLE.
Posted by Mark Thornton <mt...@optrak.co.uk>.
Rick Hillegas wrote:
> "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."
>
The more interesting question is whether those limits should remain
different or should they be brought into alignment with Java Double (and
add +-infinite and NaN as well).
Mark Thornton
Re: java.sql.SQLDataException: The resulting value is outside the
range for the data type DOUBLE.
Posted by Rick Hillegas <Ri...@Sun.COM>.
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