Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Db2 z/OS: TIMESTAMP AT TIME ZONE not supported #875

Open
ctheisen-rocket opened this issue Aug 2, 2023 · 0 comments
Open

Db2 z/OS: TIMESTAMP AT TIME ZONE not supported #875

ctheisen-rocket opened this issue Aug 2, 2023 · 0 comments

Comments

@ctheisen-rocket
Copy link

Db2 for z/OS allows TIMESTAMP AT TIMEZONE expressions.
For example, issue the following SQL at 11:30 AM UTC:
Select current timestamp at timezone '+00:00' from sysibm.sysdummy1
That returns a string like this:
2023-08-02-11.30.00.000000+00.00
(Db2 timestamp followed by timezone displacement from UTC)
However, ibm_db currently does not support that and returns "None".

See sample code below.

  • Operating System Name: Windows 10, 21H2 (Build 19044.3208)

  • db2level output from clidriver if in use:
    DB21085I This instance or install (instance name, where applicable: "DB2")
    uses "64" bits and DB2 code release "SQL11058" with level identifier
    "0609010F".
    Informational tokens are "DB2 v11.5.8000.317", "s2209201700",
    "DYN2209201700WIN64", and Fix Pack "0".
    Product is installed at "C:\PROGRA~1\IBM\SQLLIB" with DB2 Copy Name "DB2COPY1"

  • Target Db2 Server Version: Db2 12 for z/OS, function level V12R1M510

  • Python Version: 3.9.13

  • ibm_db version: 3.14

  • For non-Windows, output of below commands:
    uname
    uname -m

  • Value of below environment variables if set:
    IBM_DB_HOME: C:\Program Files\IBM\SQLLIB
    PATH: C:\Program Files\IBM\SQLLIB\java\jdk\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Windows\CCM;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files\Microsoft VS Code\bin;C:\PROGRA1\IBM\SQLLIB\BIN;C:\PROGRA1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;C:\Program Files\Python39;C:\Program Files\Python39\scripts;C:\Program Files\IBM\SQLLIB\clidriver\bin;
    LIB/LD_LIBRARY_PATH/DYLD_LIBRARY_PATH: C:\Program Files\IBM\SQLLIB\lib;

  • Test script to reproduce the problem.
    Code snippet:
    sqlText="SELECT CURRENT TIMESTAMP AS CURR_TS, CURRENT TIMESTAMP AT TIMEZONE '+00:00' AS CURR_TS_TZ FROM SYSIBM.SYSDUMMY1"
    prepStmt=ibm_db.prepare(connID,sqlText)
    returnCode=ibm_db.execute(prepStmt)
    dataRecord=ibm_db.fetch_assoc(prepStmt)
    print("Current TIMESTAMP: {}".format(dataRecord["CURR_TS"]))
    print(type(dataRecord["CURR_TS_TZ"]))
    print(str(dataRecord["CURR_TS_TZ"]))
    print("Current TIMESTAMP AT UTC: {}".format(dataRecord["CURR_TS_TZ"]))

  • For installation related issue, complete output of pip install ibm_db command.

Sample code (system timezone is EDT) returns:
Current TIMESTAMP: 2023-08-02 05:31:17.793296
<class 'NoneType'>
None
Current TIMESTAMP AT UTC: None

Correct result for Current TIMESTAMP AT UTC would be
2023-08-02 09:31:17.793296 plus Timezone information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant