Closed priyuganesan closed 1 year ago
Did you set TNS_ADMIN?
(PS, upgrade from cx_Oracle to python-oracledb)
Did you set TNS_ADMIN?
(PS, upgrade from cx_Oracle to python-oracledb)
Yes, I set that to the folder that has the tnsnames.ora and sqlnet.ora. (yes, will look to upgrade to python-oracledb soon)
Can SQL*Plus connect?
If so, share more details about the exact cx_Oracle code and network file configuration so we can check you have correct values and environment.
Can SQL*Plus connect?
If so, share more details about the exact cx_Oracle code and network file configuration so we can check you have correct values and environment.
I tried SQLPlus and see the same error there too
Z:>sqlplus /@walletalias
SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 17 09:48:49 2023 Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
ERROR: ORA-12154: TNS:could not resolve the connect identifier specified
My tnsora looks like this
My sqlnet
My python code that tries to establish connection with the db self.connector = cx_Oracle.Connection(dsn="mynetalias")
Please let me know if I am missing anything else here....
Have you set the environment variable TNS_ADMIN
to point to the location of your sqlnet.ora and tnsnames.ora files? The error you are getting suggests that it can't find your tnsnames.ora or the alias found within it!
Have you set the environment variable
TNS_ADMIN
to point to the location of your sqlnet.ora and tnsnames.ora files? The error you are getting suggests that it can't find your tnsnames.ora or the alias found within it!
I think I do...here's where my .ora files are
Here's my env variable
That value needs to be set in the shell prior to running SQL*Plus. Is it? Is the name you are trying to access actually found in the tnsnames.ora file? The error suggests that one of the two is not true. You will need to debug your configuration. You can also try with python-oracledb thin mode as you might get different error messages that may be helpful in diagnosing your configuration problems. Note that thin mode doesn't support "auto-login" wallets which you are trying to use here -- but you can certainly attempt to connect using a dummy user name and password. If you get ORA-01017 then you know the connection was successful but the authorization was not. At that point thick mode should also work. As a potential help:
# thick mode
import oracledb
oracledb.init_oracle_client(config_dir=the_location_of_tnsnames)
conn = oracledb.connect(dsn="mynetalias")
# thin mode
import oracledb
conn = oracledb.connect(dsn="mynetalias", config_dir=the_location_of_tnsnames, user="dummy", password="dummy")
You can also just do this as a way of checking the basic configuration:
import oracledb
params = oracledb.ConnectParams(config_dir=the_location_of_tnsnames)
params.parse_connect_string("mynetalias")
This issue has been automatically marked as inactive because it has not been updated recently. It will be closed if no further activity occurs. Thank you for your contributions.
DatabaseError: ORA-12154: TNS:could not resolve the connect identifier specified | Can someone please help me understand what I could be missing here ?