Skip to content

ConnectionPool ignores connectiontype parameter with externalauth=False #404

@ancc

Description

@ancc
  1. What versions are you using?

2.4.1

Give your database version.
19.11.0.0.0

Also run Python and show the output of:

import sys
import platform

print("platform.platform:", platform.platform())
print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
print("platform.python_version:", platform.python_version())

platform.platform: Linux-5.15.153.1-microsoft-standard-WSL2-x86_64-with-glibc2.28
sys.maxsize > 2**32: True
platform.python_version: 3.9.5

And:

import oracledb
print("oracledb.__version__:", oracledb.__version__)

oracledb.version: 2.4.1

  1. Is it an error or a hang or a crash?
    error

  2. What error(s) or behavior you are seeing?
    Creating custom Connection class is not used by connectionpool when specifying externalauth=False
    Tried also creating custom ConnectionPool and passing in connectiontype still not using custom Connection class.

  3. Does your application call init_oracle_client()?

yes

This tells us whether you are using the python-oracledb Thin or Thick mode.

thick

  1. Include a runnable Python script that shows the problem.
import oracledb
oracledb.init_oracle_client()

class Connection(oracledb.Connection):
    def myfunc(self):
        print('myfunc')

# trying also with custom ConnectionPool
class ConnectionPool(oracledb.ConnectionPool):
    def __init__(self, *args, **kwargs):
        kw = kwargs.copy()
        kw['connectiontype'] = Connection
        super().__init__(*args, **kw)

pool = oracledb.create_pool(dsn='test', homogeneous=False, externalauth=False, connectiontype=Connection, pool_class=ConnectionPool)
con = pool.acquire(user='dev', password='dev')
con.myfunc()

output

Traceback (most recent call last):
  File "/tmp/pool-test.py", line 18, in <module>
    con.myfunc()
AttributeError: 'Connection' object has no attribute 'myfunc'

When setting externalauth=True then con.myfunc() works.

Same thing using cx_Oracle works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions