Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8446237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:52:35+00:00 2026-06-10T09:52:35+00:00

I’ve searched around, and surprisingly can’t find an answer to this for Oracle JDBC.

  • 0

I’ve searched around, and surprisingly can’t find an answer to this for Oracle JDBC. This closely related question has answers for PostgreSQL and MySQL.

Basically, if I have two application servers in two different time zones writing timestamps to one Oracle database, what will happen? Thanks.

Edit: I should add that it seems like the value that JDBC is sending to the database when I do queries is in my local time zone.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:52:37+00:00Added an answer on June 10, 2026 at 9:52 am

    I put together some test JDBC code to figure out exactly what happens. The results were interesting. Oracle has three closely related datatypes: TIMESTAMP, TIMESTAMP WITH TIME ZONE, and TIMESTAMP WITH LOCAL TIME ZONE. I took the exact same code, and ran it from two different boxes, one in the “America/New_York” timezone, and one running on UTC. Both hit the same database, running in UTC. I was using the Oracle 11.2.0.2.0 driver.

    • The TIMESTAMP column was set to whatever the local time was on the machine executing the Java code. No time zone translation was performed.
    • The TIMESTAMP WITH TIME ZONE column translated the time to whatever timezone the JDBC client was in.
    • The TIMESTAMP WITH LOCAL TIME ZONE column also translated the time to whatever timezone the JDBC client was in.

    This article, which is a bit older, indicates that TIMESTAMP WITH TIME ZONE is pretty much useless if you want to do anything like indexes or partitions. However, it seems like TIMESTAMP WITH LOCAL TIME ZONE might be extremely useful. (Not sure what happens if you change the server’s time zone, but it seems to be intelligent about JDBC clients’ local time zones). I haven’t had a chance to test indexing behavior, etc. with these datatypes.

    Pasting in my sample class below if you’d like to reproduce my tests in your environment.

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.Timestamp;
    import java.util.Date;
    
    // create table x_tst_ts_tab(
    // os_name varchar(256)
    // ts timestamp,
    // ts_with_tz timestamp with time zone,
    // ts_with_local_tz timestamp with local time zone
    // )
    class TSTest {
        public static final void main(String[] argv) throws Exception {
            Class.forName("oracle.jdbc.OracleDriver");
            Connection conn = DriverManager.getConnection(
                "your_connection_string",
                "your_user_name",
                "your_password");
    
            try {
                // Insert some data
                Date nowDate = new Date();
                Timestamp nowTimestamp = new Timestamp(nowDate.getTime());
                PreparedStatement insertStmt = conn.prepareStatement(
                    "INSERT INTO x_tst_ts_tab"
                    + " (os_name, ts, ts_with_tz, ts_with_local_tz)"
                    + " VALUES (?, ?, ?, ?)");
                try {
                    insertStmt.setString(1, System.getProperty("os.name"));
                    insertStmt.setTimestamp(2, nowTimestamp);
                    insertStmt.setTimestamp(3, nowTimestamp);
                    insertStmt.setTimestamp(4, nowTimestamp);
                    insertStmt.executeUpdate();
                } finally {
                    try {
                        insertStmt.close();
                    } catch (Throwable t) {
                        // do nothing
                    }
                }
    
                System.out.println("os_name, ts, ts_with_tz, ts_with_local_tz");
    
                // Read back everything in the DB
                PreparedStatement selectStmt = conn.prepareStatement(
                    "SELECT os_name, ts, ts_with_tz, ts_with_local_tz"
                    + " FROM dom_fraud_beacon.x_tst_ts_tab");
                ResultSet result = null;
                try {
                    result = selectStmt.executeQuery();
                    while (result.next()) {
                        System.out.println(
                            String.format("%s,%s,%s,%s",
                                          result.getString(1),
                                          result.getTimestamp(2).toString(),
                                          result.getTimestamp(3).toString(),
                                          result.getTimestamp(4).toString()
                                          ));
                    }
                } finally {
                    try {
                        result.close();
                    } catch (Throwable t) {
                        // do nothing
                    } finally {
                        try {
                            selectStmt.close();
                        } catch (Throwable t) {
                            // do nothing
                        }
                    }
                }
            } finally {
                try {
                    conn.close();
                } catch (Throwable t) {
                    // do nothing
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
This could be a duplicate question, but I have no idea what search terms
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.