Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 21081 invoked from network); 28 Jan 2008 13:52:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Jan 2008 13:52:28 -0000 Received: (qmail 69587 invoked by uid 500); 28 Jan 2008 13:52:17 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 69555 invoked by uid 500); 28 Jan 2008 13:52:17 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 69544 invoked by uid 99); 28 Jan 2008 13:52:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jan 2008 05:52:17 -0800 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.43.133] (HELO sca-es-mail-2.sun.com) (192.18.43.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jan 2008 13:52:02 +0000 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m0SDpsxG028899 for ; Mon, 28 Jan 2008 05:51:54 -0800 (PST) Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JVC00301X36HF00@fe-sfbay-09.sun.com> (original mail from Richard.Hillegas@Sun.COM) for derby-user@db.apache.org; Mon, 28 Jan 2008 05:51:54 -0800 (PST) Received: from richard-hillegas-computer.local ([129.150.17.62]) by fe-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JVC00HHRX6HNED0@fe-sfbay-09.sun.com> for derby-user@db.apache.org; Mon, 28 Jan 2008 05:51:54 -0800 (PST) Date: Mon, 28 Jan 2008 05:52:44 -0800 From: Rick Hillegas Subject: Re: java.sql.SQLDataException: The resulting value is outside the range for the data type DOUBLE. In-reply-to: Sender: Richard.Hillegas@Sun.COM To: Derby Discussion Message-id: <479DDE2C.9050700@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT References: User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) X-Virus-Checked: Checked by ClamAV on apache.org 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 . > > Regards, > Hong