PreparedStatement.setObject Is Broken When Passed A LocalDate
(Doc ID 2999014.1)
Last updated on JANUARY 19, 2024
Applies to:
JDBC - Version 23.2 and laterInformation in this document applies to any platform.
Symptoms
On JDBC 23.2.0.0, PreparedStatement.setObject is broken when passed a LocalDate
When you set a DATE field by passing a LocalDate to PreparedStatement.setObject the field is set with time portion set to 12:00:00 while 00:00:00 is exepected.
Apparently the problem lies in oracle.sql.DATE.toBytes:
public static byte[] toBytes(LocalDate ld) {
return ld == null ? null : toBytes(ld.atTime(12, 0, 0));
}
The problem is present in version 23.2.0.0 and 23.3.0.23.09 of ojdbc11.jar, and is not present in 21.11.0.0 and earlier.
Cause
To view full details, sign in with your My Oracle Support account. |
|
Don't have a My Oracle Support account? Click to get started! |
In this Document
Symptoms |
Cause |
Solution |
References |