Skip to content

systimestamp different between cx_Oracle and oracledb #140

@BayerSe

Description

@BayerSe
  1. What versions are you using?
Oracle 19c
platform.platform: Linux-5.4.0-137-generic-x86_64-with-glibc2.31
sys.maxsize > 2**32: True
platform.python_version: 3.10.9
oracledb.__version__: 1.2.2
  1. Is it an error or a hang or a crash?

Error

  1. What error(s) or behavior you are seeing?

The value of systimestamp is wrong, it is different to the value in the database and the value reported by cx_Oracle.

  1. Does your application call init_oracle_client()?

No.

  1. Include a runnable Python script that shows the problem.
import oracledb
import cx_Oracle

user ="..."
password = "..."
dsn = "...

with oracledb.connect(user=user, password=password, dsn=dsn) as connection:
    with connection.cursor() as cursor:
        sql = """select systimestamp, current_timestamp from dual"""
        for r in cursor.execute(sql):
            print(r)


with cx_Oracle.connect(user=user, password=password, dsn=dsn) as connection:
    with connection.cursor() as cursor:
        sql = """select systimestamp, current_timestamp from dual"""
        for r in cursor.execute(sql):
            print(r)

    import oracledb
    print("oracledb.__version__:", oracledb.__version__)
(datetime.datetime(2023, 2, 10, 12, 0, 22, 342835), datetime.datetime(2023, 2, 10, 11, 0, 22, 342837))
(datetime.datetime(2023, 2, 10, 12, 0, 22, 648352), datetime.datetime(2023, 2, 10, 12, 0, 22, 648355))

The value of "systimestamp" is off by 1 hour when using oracledb instead of cx_Oracle.

The values reported by the database are:

2023-02-10 12:05:12.906225 +01:00
2023-02-10 11:05:12.906228 +00:00

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions