Skip to content

Using create_pool with Oracle Wallet #36

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

Closed
glM26 opened this issue Jul 18, 2022 · 2 comments
Closed

Using create_pool with Oracle Wallet #36

glM26 opened this issue Jul 18, 2022 · 2 comments

Comments

@glM26
Copy link

glM26 commented Jul 18, 2022

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)
@anthony-tuininga
Copy link
Member

This issue was found internally and should be fixed in python-oracledb 1.0.2 which was just released. Can you verify?

@glM26
Copy link
Author

glM26 commented Jul 19, 2022

Thank you for the quick reply. I can confirm that the issue was fixed with the 1.0.2 release.

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

2 participants