0

I would like to fetch the values inserted in a TIMESTAMP column in Oracle using Java. The TIMESTAMP is stored as UTC and also the JVM timezone is set to UTC.

My question is: What Java type should I use to read a TIMESTAMP in UTC from an Oracle table ?

Is it ok to map the value returned by the select query to java.time.Instant ? It's working fine when I set the JVM timezone to UTC. Or should I use a different type ? Maybe a java.time.LocalDateTime ?

I was using java.time.Instant and TIMESTAMP WITH TIMEZONE before but I would like to partition my table based on the timestamp now, and I'm not able to do that since Oracle doesn't support partitioning based on a column with timezone.

I'm currently using Oracle 18.4 XE and OpenJDK 11.

Might be a duplicate question already, but I couldn't find an answer.

Issam2204
  • 69
  • 1
  • 1
  • 4

0 Answers0