-
Notifications
You must be signed in to change notification settings - Fork 75
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
thick mode connect isn't honoring TNS_ADMIN or using ldap connection #398
Comments
A couple of things to try:
|
I've unset the variables you suggested, copied the .ora files to the admin directory and enabled tracing but it hasn't helped the situation at all. There is something different between oracledb using the oci layer and sqlplus. They are both reading the sqlnet.ora and ldap.ora files correctly and I can see the attempt to connect to the ldap server. However the oracledb connection is failing. This is the part of the trc where they differ. sqlplus:
oracledb:
I'm not sure what the difference is or why oracledb is getting an 0x2 return and then failing to get the server. |
Can you confirm that both SQL*Plus and python-oracledb are using the same Oracle Client (/opt/oracle/instantclient_23_3)? |
Yes they are. It is the only client installed. |
Some more questions from the network experts at Oracle:
|
Yes I have openldap installed. Setting DYLD_PRINT_LIBRARIES=YES does not show it trying to load openldap.
|
If possible can you uninstall openldap and run the application? Oracle client libraries come bundled with its own ldap library and there could be some interference with openldap. Could be worth a shot. |
There are not changes between having openldap installed and not. |
platform.platform: macOS-15.0-arm64-arm-64bit
sys.maxsize > 2**32: True
platform.python_version: 3.12.6
oracledb.version: 2.4.1
Error
When trying to connect to a database I'm getting the following error:
$ env | grep -E 'ORA|TNS|PATH'
TNS_ADMIN=/opt/oracle
PATH=/opt/oracle/instantclient_23_3:...
INFOPATH=/opt/homebrew/share/info:
ORACLE_HOME=/opt/oracle/instantclient_23_3
$ python test.py
Traceback (most recent call last):
File "/Users/slords/test.py", line 8, in
c=oracledb.connect(user=user, password=password, dsn=dsn)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/slords/.venv/lib/python3.12/site-packages/oracledb/connection.py", line 1169, in connect
return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/slords/.venv/lib/python3.12/site-packages/oracledb/connection.py", line 554, in init
impl.connect(params_impl, pool_impl)
File "src/oracledb/impl/thick/connection.pyx", line 494, in oracledb.thick_impl.ThickConnImpl.connect
File "src/oracledb/impl/thick/utils.pyx", line 446, in oracledb.thick_impl._raise_from_info
oracledb.exceptions.DatabaseError: ORA-12154: Cannot connect to database. Could not find alias whse_dev in /opt/oracle/instantclient_23_3/network/admin/tnsnames.ora.
Help: https://docs.oracle.com/error-help/db/ora-12154/
If I run the same connect using sqlplus it connects fine to the database. I've got sqlnet.ora and ldap.ora in /opt/oracle. We don't use tnsnames.ora and that file has never existed in any of our installs.
Yes
$ cat test.py
import oracledb
oracledb.init_oracle_client(lib_dir='/opt/oracle/instantclient_23_3')
user='user'
password='pass'
dsn='ldap_alias'
c=oracledb.connect(user=user, password=password, dsn=dsn)
The text was updated successfully, but these errors were encountered: