JDBC Oracle driver PreparedStatement.setTimestamp() using a Calendar object

From: Marc Missire <missire_at_netscape.com>
Date: 1999/11/12
Message-ID: <382C6CF2.48FC96BA_at_netscape.com>#1/1


Hi,

The JDBC 2.0 spec says that in a JDBC driver, the method PreparedStatement.setTimestamp( int parameterIndex, java.sql.Timestamp ts, java.util.cal cal) uses the passed-in cal object to adjust the timestamp only if the underlying
database "does not store time zone information." Presumeably, if the database DOES store time zone information, the cal object is ignored.

From what I can tell, Oracle's DATE datatype does not store time zone information, and the OCI manuals talk a bit about writing your applications carefully if they cross time zones (they tell you to modify timestamps appropriately, I think).

So would the proper thing to do in an Oracle JDBC driver be to unconditionally modify a copy of the timestamp based on the time zone of the passed-in cal object, and store this in the database (and doing the reverse modification for getTimestamp)? Sounds like it to me.

Or does this behavior vary with different versions of the Oracle server, and do I therefore need to somehow query the database to see if it has stored time zone information. I'm unclear on this part of the JDBC spec.

Thanks for any info/opinions.

-Marc Received on Fri Nov 12 1999 - 00:00:00 CET

Original text of this message