My Oracle Support Banner

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 later
Information in this document applies to any platform.


On JDBC, 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 and of ojdbc11.jar, and is not present in and earlier.



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

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.