oracle / python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
https://oracle.github.io/python-oracledb
Other
308 stars 61 forks source link

oracledb.exceptions.NotSupportedError: DPY-3015: password verifier type 0x939 is not supported by python-oracledb in thin mode #246

Closed vbnmhjkl098 closed 8 months ago

vbnmhjkl098 commented 8 months ago
  1. What versions are you using? platform.platform: Linux-3.10.0-1160.99.1.el7.x86_64-x86_64-with-glibc2.2.5 sys.maxsize > 2**32: True platform.python_version: 3.8.14 oracledb.version: 1.4.2 Oracle Database 19c Enterprise Edition Release 19.0.0.0.0

  2. Is it an error or a hang or a crash? Error.

  3. What error(s) or behavior you are seeing? I'm able to execute select sql on one of my database, but on the same server, I'm not able to execute the same sql on the other database which I actually want. It's similiar to this issue: https://github.com/oracle/python-oracledb/issues/26. But it's weird because the database that I can't connect has this setting: sec_case_sensitive_logon=TRUE

  4. Does your application call init_oracle_client()? No. I'm using thin mode.

  5. Include a runnable Python script that shows the problem. I'm very sorry there are some unnecessary information I need to hide, I replaced them with xxx.

bash-4.25 /opt/rh/rh-python38/root/usr/bin/python3.8 insert.py --ods_db db_able_to_connect select table: select * from dis 1017 (1. 'Summer Promotion'; 9.5, datetime.datetime(2017, 5, 1, 0, 0), datetime,datetime(2017, 8, 31, 0, 0)

bash-4.25 /opt/rh/rh-python38/root/usr/bin/python3.8 insert.py --ods_db db_not_able_to_connect

Traceback (most recent call last):
File "insert.py", line 85, in ‹module>
main(vars(args))
File "insert.py", line 76, in main select_table(args.ods_db, SELECT_SQL)
File "insert.py", line 36, in select_table
ods_conn = get_oracle_conn(ods_ab)
File "/xxx/oracle_util.py". line 11, in get_oracle_conn
return oracledb.connect(user=db infol'user'], password=db_infol'password'],
File "/home/xxx/local/lib/python3.8/site-packages/oracledb/connection.py", line 1020, in connect return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
File "/home/xxx/local/lib/python3.8/site-packages/oracledb/connection.py", line 130, in _init_ impl.connect(params_impl)
File "src/oracledb/impl/thin/connection.pyx", line 338, in oracledb.thin impl.ThinConnImpl.connect File "src/oracledb/impl/thin/connection.pyx", line 328, in oracledb.thin_impl.ThinConnImpl.connect File "src/oracledb/impl/thin/connection.pyx", line 215, in oracledb.thin_impl.ThinConnImpl. connect_with_params File "src/oracledb/impl/thin/connection.pyx", line 186, in oracledb.thin impl.ThinConnImpl._connect _with_description File "src/oracledb/impl/thin/connection.pyx", line 127, in oracledb.thin_impl.ThinConnImplconnect_with_address
File "src/oracledb/impl/thin/protocol.pyx", line 266, in oracledb.thin impl.Protocol. _connect_phase_two File "src/oracledb/impl/thin/protocol.pyx", line 381, in oracledb.thin impl.Protocol._process_message File "src/oracledb/impl/thin/protocol.pyx", line 358, in oracledb.thin impl.Protocol. process_message File "src/oracledb/impl/thin/messages.pyx", line 297, in oracledb.thin impl.Message.send File "src/oracledb/impl/thin/messages.pyx", line 1597, in oracledb.thin impl.AuthMessage. write message File "/home/xxx/local/lib/python3.8/site-packages/oracledb/errors.py", line 127, in _raise_err raise exc_typeError(message)) from cause
**oracledb.exceptions.NotSupportedError: DPY-3015: password verifier type 0x939 is not supported by python-oracledb in thin mode**
#################################################################
#!/opt/rh/rh-python38/root/usr/bin/python3.8
#-*- coding:utf-8 -*-
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
from utils.oracle_util import get_oracle_conn

def select_table(ods_db: str, sql):
    ods_conn = get_oracle_conn(ods_db)
    with ods_conn as connection:
        with connection.cursor0 as cursor:
            print("select table: ")
            print(sql)
        for row in cursor.execute(sql):
            print(row)
            connection.commit()

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument('--instance')
    parser.add_argument('--ods_db')
    user_input = parser.parse_args()
    return user_input

def main(params):
    for var, value in params.items():
        setattr(args, var, value)

    SELECT_SQL = '''select * from dis_1017'''
    select_table(args.ods_db, SELECT_SQL)
#/opt/rh/rh-python38/root/usr/bin/python3.8 insert_example.py --ods_db db_able_to_connect
#/opt/rh/rh-python38/root/usr/bin/python3.8 insert_example.py-ods_db db_not_able_to_connect

if __name__ =='__main__':
    args = parse_args()
    main(vars(args))
anthony-tuininga commented 8 months ago

This is not a bug! The 10g password verifier is not supported and there are no plans to support it in the future. Take a look at the password_versions column in the dba_users view for the user you are trying to use. If it says 10g, please change the password of the user (even to the same value) which will regenerate the password verifiers and remove the 10g verifier and replace it with 11g or 12c verifiers.

vbnmhjkl098 commented 8 months ago

This is not a bug! The 10g password verifier is not supported and there are no plans to support it in the future. Take a look at the password_versions column in the dba_users view for the user you are trying to use. If it says 10g, please change the password of the user (even to the same value) which will regenerate the password verifiers and remove the 10g verifier and replace it with 11g or 12c verifiers.

Yes, thanks, anthony. It's exactly 10g.

anthony-tuininga commented 8 months ago

Great! Did you change the password and are you able to connect now?

cjbj commented 8 months ago

For general reference, see the python-oracledb doc https://python-oracledb.readthedocs.io/en/latest/user_guide/troubleshooting.html#dpy-3015

vbnmhjkl098 commented 8 months ago

Great! Did you change the password and are you able to connect now?

Yes! Thanks a lot!