Skip to content

Using create_pool with Oracle Wallet #36

@glM26

Description

@glM26

We currently use the cx_Oracle-package-SessionPool() to connect to our Oracle-database.
Username and password are taken from an Oracle Wallet configured in sqlnet.ora:

WALLET_LOCATION = (SOURCE = (METHOD = FILE) (METHOD_DATA = (DIRECTORY = /opt/shared/shsdb/operation/etc/oracle_wallet) ) ) SQLNET.WALLET_OVERRIDE = TRUE 

Content of tnsnames.ora:

SHSDQD.WORLD = (DESCRIPTION = (CONNECT_TIMEOUT=10)(RETRY_COUNT=3) (ADDRESS_LIST = (ADDRESS=(PROTOCOL=TCP)(HOST= HOST_1)(PORT=1721)) (ADDRESS=(PROTOCOL=TCP)(HOST= HOST_2)(PORT=1721)) ) (CONNECT_DATA=(SERVICE_NAME=SHSDQD_PRIM.WORLD)(SERVER=DEDICATED)) ) 

We currently use code from this cx_Oracle issue.

import cx_Oracle con=cx_Oracle.SessionPool(dsn="SHSDQD.WORLD", encoding="UTF-8", externalauth=True, homogeneous=False) con.acquire() <cx_Oracle.Connection to externally identified user> 

With a single connect-call this works also with python-oracledb in thick-mode:

import oracledb oracledb.init_oracle_client() oracledb.connect("SHSDQD.WORLD") <oracledb.Connection to externally identified user> 

Unfortunately, when I try the equivalent code to cx_Oracle.SessionPool in python-oracledb I get an error:

import oracledb oracledb.init_oracle_client() con = oracledb.create_pool(dsn="SHSDQD.WORLD", externalauth=True, homogeneous=False) con.acquire() Traceback (most recent call last): File "<stdin>", line 1, in <module> File ".../VENV/lib64/python3.8/site-packages/oracledb/pool.py", line 148, in acquire return self._connection_type(user=user, password=password, File ".../VENV/lib64/python3.8/site-packages/oracledb/connection.py", line 131, in __init__ impl.connect(params_impl, pool_impl) File "src/oracledb/impl/thick/connection.pyx", line 360, in oracledb.thick_impl.ThickConnImpl.connect File "src/oracledb/impl/thick/utils.pyx", line 410, in oracledb.thick_impl._raise_from_odpi File "src/oracledb/impl/thick/utils.pyx", line 400, in oracledb.thick_impl._raise_from_info oracledb.exceptions.DatabaseError: ORA-24415: Missing or null username. 

Are there other options I need to use in python-oracledb to make session pools work in python-oracledb with Oracle Wallet?

We currently use the following Oracle Client:

>>> oracledb.clientversion() (12, 2, 0, 1, 0) 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions