2011-06-14

a bug of JDBC 10.2 with JDK 1.5

original link : http://marist89.blogspot.com/2008/12/bug-part-ii.html
Oracle (the database software) let a bad piece of data in. Oracle says the client should type the data when binding. I agree. But I also think that the server shouldn't let non-numeric data into numeric columns, regardless. I contend that this is a bug on the server side as well as a bug on the client side. This is only one specific case of a Java program inserting bad data.



Know Problems Using BigDecimal in JDBC 10.2 with JDK 1.5 [ID 421008.1]

Applies to:

JDBC - Version: 10.2.0.0 to 10.2.0.5
Information in this document applies to any platform.
JDK 1.5

Purpose

The purpose of this note is to summarize the problems that exists when using BigDecimal in JDBC 10.2 in conjunction with JDK 1.5.

It also provides know workarounds and fixes for the problems.

Scope and Application

Before reading this document, the user must have a good understanding of JDBC.

Know Problems Using BigDecimal in JDBC 10.2 with JDK 1.5

The Constructor oracle.sql.NUMBER(BigDecimal) does not work Correctly if the BigDecimal is Constructed from a String

Bug Description:
If you are getting wrong oracle.sql.NUMBER object from java BigDecimal, and the BigDecimal object itself constructed using exponent indicator either 'E' or 'e ', and using JDK 1.5 then you may be hitting this bug.

Cause:
Bug 5161005 - ORACLE.SQL.NUMBER(BIGDECIMAL) GIVES WRONG VALUE

Workaround:
Use JDK 1.4, or earlier.

Fix:
This bug will be fixed as of release 10.2.0.5.0 and later including 11g.
For some versions before 10.2.0.5.0 a patch is available. The available versions cane be found at Patch 5161005. If you need a backport for this fix to another version, please file a Service Request.

Using setBigDecimal() for Small Negative Values Corrupts Inserted Data

Bug Description:
Bind value BigDecimal (-0.0000007D), if it is inserted incorrectly then you might have hit this bug.

Cause:
Bug 4711863 - SETBIGDECIMAL CORRUPTS NUMBER FOR NEGATIVE VALUES

Workaround:
Use JDK 1.4.

Fix:
This bug will be fixed as of release 10.2.0.4.0 and later including 11g.
For some versions before 10.2.0.4.0 a patch is available. The available versions cane be found at Patch 4711863. If you need a backport for this fix to another version, please file a Service Request.

Inserting BigDecimal with MathContext Inserts Wrong Value

Bug Description:
When using MathContext, insert a value BigDecimal (100000000, MathContext(6)). If the inserted value is wrong in JDK version >= 1.5 you may have hit this bug.

Cause:
Bug 5379371 - BIGDECIMAL WITH MATHCONTEXT INSERTS BAD VALUE JDK 1.5

Workaround:
Do not use MathContext.

Fix:This bug will be fixed as of release 10.2.0.4.0 and later including 11g.
For some versions before 10.2.0.4.0 a patch is available. The available versions cane be found at Patch 5379371. If you need a backport for this fix to another version, please file a Service Request.

References

BUG:4711863 - SETBIGDECIMAL CORRUPTS NUMBER FOR NEGATIVE VALUES
BUG:5161005 - ORACLE.SQL.NUMBER(BIGDECIMAL) GIVES WRONG VALUE
BUG:5379371 - BIGDECIMAL WITH MATHCONTEXT INSERTS BAD VALUE JDK 1.5

Niciun comentariu:

Trimiteți un comentariu