1 Reply Latest reply on Feb 7, 2019 1:27 AM by jyi

    Need to change the default timezone in JDBC

    kstone84

      I am pulling the PI data through PI JDBC in a select statement
      like below:

      Select  * from piarchive.piinterp

      WHERE tag = 'YYYYYYYYYY'

      AND time between ‘1/1/2019 00:00:00’ and ‘1/2/2019 00:00:00’

      AND timestep = '1h'

      order by time;

       

      Is it possible to specify the time zone that I pass to the time
      in the where clause?  Is there an example to show how to pass utc to
      retrieve the data?

        • Re: Need to change the default timezone in JDBC
          jyi

          Hi Keith,

           

          Currently, PI JDBC Driver has a limitation against time zone. By default, the time literals are interpreted at the PI SQL DAS server node. According to its user guide,

          Time Zone

          Time Zone/DST settings must be the same for the PI SQL DAS computer and the PI JDBC Driver client computer. Moreover, the PI OLEDB-specific connection property Time Zone cannot be used. If specified, the setting has no effect.

           

          So if your PI SQL DAS server and PI JDBC Driver are installed in a different time zone, then above limitation can be troublesome.

          One workaround is to show the _utctime column for a returned dataset from PI by adding  "Show Hidden Metadata = True" initialization property into the connection string. Hopely this will clear up some confusion around what time I am passing to my PI Data/Asset servers.

          I hope this helps.

           

          Best,

          Jin

          1 of 1 people found this helpful