我可以将TIMESTAMP与TIME ZONE或TIMESTAMP与LOCAL TIME ZONE映射到哪些Java数据类型?

时间:2020-12-19 16:58:49

To which Java data types can (or should) my application map Oracle column types TIMESTAMP WITH TIME ZONE or TIMESTAMP WITH LOCAL TIME ZONE? Can the Oracle JDBC driver map these types to either Date or Calendar objects? Does Calendar preserve the time zone value whereas Date does not?

哪些Java数据类型可以(或应该)我的应用程序映射Oracle列类型TIMESTAMP WITH TIME ZONE还是TIMESTAMP WITH LOCAL TIME ZONE? Oracle JDBC驱动程序可以将这些类型映射到Date或Calendar对象吗? Calendar是否保留时区值,而Date不保留?

1 个解决方案

#1


3  

The JDBC 4.0 Specification does not even mention time zones, so JDBC does not specify how a JDBC driver should handle SQL type TIMEZONE WITH TIME ZONE or how to interpret the time zone that may appear in a TIMESTAMP literal value. So, the JDBC specification leaves time zone interpretation entirely up to the JDBC driver implementation!

JDBC 4.0规范甚至没有提到时区,因此JDBC没有指定JDBC驱动程序应如何处理SQL类型TIMEZONE WITH TIME ZONE或如何解释可能出现在TIMESTAMP文字值中的时区。因此,JDBC规范完全取决于JDBC驱动程序实现的时区解释!

#1


3  

The JDBC 4.0 Specification does not even mention time zones, so JDBC does not specify how a JDBC driver should handle SQL type TIMEZONE WITH TIME ZONE or how to interpret the time zone that may appear in a TIMESTAMP literal value. So, the JDBC specification leaves time zone interpretation entirely up to the JDBC driver implementation!

JDBC 4.0规范甚至没有提到时区,因此JDBC没有指定JDBC驱动程序应如何处理SQL类型TIMEZONE WITH TIME ZONE或如何解释可能出现在TIMESTAMP文字值中的时区。因此,JDBC规范完全取决于JDBC驱动程序实现的时区解释!