python-oracledb icon indicating copy to clipboard operation
python-oracledb copied to clipboard

Thick mode: Connection.gettype error

Open hummeltech opened this issue 1 year ago • 7 comments

  1. What versions are you using?

    platform.platform: Linux-6.5.9-arch2-1-x86_64-with-glibc2.38
    sys.maxsize > 2**32: True
    platform.python_version: 3.11.5
    
    oracledb.__version__: 1.4.2
    
  1. Is it an error or a hang or a crash? Error

  2. What error(s) or behavior you are seeing? Connection.gettype() is failing when using Thick mode, however runs without error when using Thin mode.

    Thick mode:

    >>> connection.gettype("PDBADMIN.TESTTEST.STR_ARR")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.11/site-packages/oracledb/connection.py", line 437, in gettype
        obj_type_impl = self._impl.get_type(self, name)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "src/oracledb/impl/thick/connection.pyx", line 539, in oracledb.thick_impl.ThickConnImpl.get_type
      File "src/oracledb/impl/thick/utils.pyx", line 431, in oracledb.thick_impl._raise_from_odpi
      File "src/oracledb/impl/thick/utils.pyx", line 421, in oracledb.thick_impl._raise_from_info
    oracledb.exceptions.DatabaseError: ORA-04043: object PDBADMIN.TESTTEST.STR_ARR does not exist
    

    Thin mode:

    >>> connection.gettype("PDBADMIN.TESTTEST.STR_ARR")
    <oracledb.DbObjectType PDBADMIN.TESTTEST.STR_ARR>
    
  1. Does your application call init_oracle_client()? Yes
  1. Include a runnable Python script that shows the problem. Start up a clean database:
    docker run \
      --env ORACLE_PWD=password \
      --interactive \
      --publish 1521:1521 \
      --rm \
      --tty \
      container-registry.oracle.com/database/express:21.3.0-xe
    
    Create a simple package:
    CREATE OR REPLACE PACKAGE PDBADMIN.TESTTEST AS
        TYPE STR_ARR IS
            TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER;
    END;
    
    Try and run Connection.gettype() on the type from the newly created package:
    import os
    import oracledb
    oracledb.init_oracle_client() # The script does not fail when commenting out this line (I.E. when using `thin mode`)
    connection = oracledb.connect(
        host="localhost",
        password="password",
        port=1521,
        service_name="XEPDB1",
        user="PDBADMIN",
    )
    connection.gettype("PDBADMIN.TESTTEST.STR_ARR")
    

hummeltech avatar Nov 02 '23 20:11 hummeltech

For me, python-oracledb Thin and Thick (and cx_Oracle 8.3) all fail with Oracle Instant Client 21.1 against Oracle DB 21.3 EE , but all work against Oracle DB Free 23.3.0.23.9.

cjbj avatar Nov 03 '23 03:11 cjbj

Hello @cjbj, thank you for the report, I have also tried with an older version which produces the same error (again, only when using Thick mode):

Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production

hummeltech avatar Nov 03 '23 03:11 hummeltech

@hummeltech try a newer version!! :)

cjbj avatar Nov 03 '23 04:11 cjbj

Haha, yes I did indeed try with newer versions (19c & 21.3.0-xe) and have the same problem there. The issue is that I need to work with multiple versions of the database and Thin mode doesn't support the older versions.

hummeltech avatar Nov 09 '23 18:11 hummeltech

@hummeltech since the driver does work unchanged with the latest DB, I suspect you've hit some DB limitation that was removed in a new version. You'll probably need to think about work arounds.

However I'll leave this issue open until we can review what the driver is sending/getting via Thick mode Oracle Client libraries.

cjbj avatar Nov 13 '23 16:11 cjbj

I just tried this myself using 19.15 and 21.6 clients against the XE database that you suggested and did not run into any difficulties with either thick or thin clients. Can you try with the latest instant clients (https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html) and the latest version of python-oracledb (2.0.1) and let me know if you still have difficulties? Thanks!

anthony-tuininga avatar Feb 02 '24 01:02 anthony-tuininga

Thanks for taking a look, I will try the new version!

hummeltech avatar Feb 02 '24 18:02 hummeltech

Closing - no activity.

cjbj avatar Apr 10 '24 14:04 cjbj