[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-java
Subject:    Re: ResultSet.getFloatFromString doesn't handle Float.NaN or does
From:       Mark Matthews <mark () mysql ! com>
Date:       2006-04-06 21:48:42
Message-ID: 44358CBA.1030901 () mysql ! com
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ronald Klop said the following on 4/6/2006 8:16 AM:
> Hello,
> 
> If my database contains NaN and I do getObject on the field there is an
> exception.
> 
> Caused by: java.sql.SQLException: Invalid value for getFloat() - 'nan'
> in column 27
> at com.mysql.jdbc.ResultSet.getFloatFromString(ResultSet.java:2237)
> at com.mysql.jdbc.ResultSet.getFloat(ResultSet.java:2173)
> at com.mysql.jdbc.ResultSet.getObject(ResultSet.java:4388)
> at
> nl.base.sql.utils.ResultSetDataSource.getCache(ResultSetDataSource.java:146)
> 
> 
> If I look at the source of that method. The value of NaN is not handled.
> Any thoughts?
> I'm using Connector/J 3.1.11, with MySQL 4.0.24.
> 
> Ronald.

Ronald,

Technically "NaN" is not a valid number in standard SQL for any numeric
type, including FLOAT, so MySQL doesn't support it (it used to on some
platforms dependent on support by the C runtime of the platform, but it
no longer does).

C/J 3.0.x can support this via rounding, but the functionality was
removed in C/J 3.1 since the versions of MySQL it supported don't
uniformly support "NaN" as a FLOAT.

	-Mark

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFENYy6tvXNTca6JD8RAk2OAJ0epmblgxxehu8IBtyKtJSPYb301gCgmG+k
oxLhfLmPdf7c4zebYvpwBBc=
=3Y3z
-----END PGP SIGNATURE-----

-- 
MySQL Java Mailing List
For list archives: http://lists.mysql.com/java
To unsubscribe:    http://lists.mysql.com/java?unsub=mysql-java@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic