Re: NullPointerException in java.lang.FloatingDecimal.readJavaFormatString with Oracle driver
- From: "Dave" <drathnow@xxxxxxxxx>
- Date: 5 Mar 2007 07:22:00 -0800
The column is a FLOAT and when I try getBigDecimal(5), it returns
zero
(i.e. no errors.)
Dave.
On Mar 2, 9:54 pm, "joeNOS...@xxxxxxx" <joe.weinst...@xxxxxxxxx>
wrote:
On Mar 2, 3:13 pm, "Dave" <drath...@xxxxxxxxx> wrote:
I've run into a problem reading values from a couple of rows in our
database. I've created a piece of code to
reproduce the problem.
....
ResultSet resultSet = statement.executeQuery("select * from iocurrent
where ioid = " + ioId);
if (resultSet.next()) {
byte[] bytes = resultSet.getBytes(5);
HexStringEncoder encoder = new HexStringEncoder();
System.out.println("Hex Value: " +
encoder.bytesAsHexString(bytes));
System.out.println("Value: " + resultSet.getDouble(5));
}
The value in the field causing the problem is not null. I can view
the values with a couple of
different interactive SQL tools but when I try to run my code, I get
the following exception:
Hex Value: C1 01
java.lang.NullPointerException
at
java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:
980)
at java.lang.Double.valueOf(Double.java:202)
at oracle.sql.NUMBER.toDouble(NUMBER.java:331)
at
oracle.jdbc.dbaccess.DBConversion.NumberBytesToDouble(DBConversion.java:
3050)
at
oracle.jdbc.driver.OracleStatement.getDoubleValue(OracleStatement.java:
4668)
at
oracle.jdbc.driver.OracleResultSetImpl.getDouble(OracleResultSetImpl.java:
593)
at Test.boom2(Test.java:81)
at Test.main(Test.java:68)
I am using an Oracle 9i JDBC driver.
Has anyone seen this problems and could you suggest a fix?
Thanks,
Dave.
What is the 5th column of the table defined as?
What do you get if you do a getBigDecimal(5)?
Joe Weinstein at BEA Systems
.
- Follow-Ups:
- Re: NullPointerException in java.lang.FloatingDecimal.readJavaFormatString with Oracle driver
- From: joeNOSPAM@xxxxxxx
- Re: NullPointerException in java.lang.FloatingDecimal.readJavaFormatString with Oracle driver
- References:
- Prev by Date: Re: FilteredRowSet size
- Next by Date: Re: NullPointerException in java.lang.FloatingDecimal.readJavaFormatString with Oracle driver
- Previous by thread: Re: NullPointerException in java.lang.FloatingDecimal.readJavaFormatString with Oracle driver
- Next by thread: Re: NullPointerException in java.lang.FloatingDecimal.readJavaFormatString with Oracle driver
- Index(es):