Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> IBM JVM bug found while retrieving floats from JDBC 1.0
Has anyone else seen this bug?
Using the IBM JVM v1.1.8, the JDBC API call ResultSet.getFloat() and ResultSet.getDouble() give incorrect values.
The database server is Oracle v8.1.5. The client is using Oracle v8.1.6
thin JDBC client classes. (classes111.zip). The data type of the affected columns is NUMBER.
While running the JVM with JIT turned off, everything works well. While
running the JVM with the JIT enabled, the values are seemingly random.
Here are some sample values returned for calls to retrieve the same
piece of data,
461740.94
461741.4.
4617.4097
Interestingly, though, the correct value is stored in the result set, and can be retrieved by calling ResultSet.getString() and parsing that out into a float.
Here's some sample code.
Connection conn = mgr.getConnection();
Statement stmnt = conn.createStatement(); ResultSet results = stmnt.executeQuery("select * from archivematched");
System.out.println("Executing query..."); while (results.next()) {
System.out.print("Archive ID = " + results.getLong("id") + " / "); System.out.print("float value = " + results.getDouble(3) + " / "); System.out.print("Int value = " + results.getInt("arty") + " / ");
String txt = results.getString("arty");
Float f = Float.valueOf(txt);
System.out.println("From string = " + f.floatValue());
}
Received on Mon Oct 04 1999 - 13:59:37 CDT