Closed skrishnabharat closed 4 years ago
As it is TCPS protocol.I have add the sqlnet.ora and tnsnames.ora in the path instantclient_19_3 \network\admin.
but I still getting the same error.Any Suggestions.
The common case of this error is that you have wallet files in a non-default location and haven't updated WALLET_LOCATION in sqlnet.ora.
I can see there is some issue with the sqlnet.ora and tnsnames.ora after updating the files I'm getting new error
ORA-12560: TNS:protocol adapter error
Give us more details (with private information redacted) - what's in each file and what is your Python code. Are you using a wallet to access Oracle DB? If so, use the connect alias from the tnsnames.ora file instead of hardcoding the connection string like you did in your original post.
Thanks for your inputs .I ave tred it but still the issue is not resolved. I feel it's due to openssl version. Could you please provide the steps to update openssl version in mac.
(base) HYDHTC7175D:~ krishnabharat.sathi$ openssl version OpenSSL 1.1.1d 10 Sep 2019
Without more information about your problem, I wouldn't head down that path.
sqlnet.ora
wallet_location=(SOURCE=(METHOD=File)(METHOD_DATA=(DIRECTORY=/Users/krishnabharat.sathi/instantclient_19_3/network/admin)))
tnsnames.ora
lgst = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCPS)(Host =** )(Port =**)) ) (CONNECT_DATA = (SERVICE_NAME = ) ) )
code used to connect:
import cx_Oracle as cx conn = cx.connect(user='**', password='**', dsn='lgst') print(conn.version) conn.close()
Try connecting with SQL*Plus.
If the error occurs, create a file ~/.sqlnet.ora
(note the leading period) containing:
adr_base=/tmp/mylogs
diag_adr_enabled=ON
trace_level_client=16
Run mkdir /tmp/mylogs
and run SQL*Plus again.
Check the logs in /tmp/mylogs//...//trace/* to see if there is any clue
Closing - no activity.
Did you ever solve this? We are having the similar TNS Protocol Adapter error with similar configuration.
As @cjbj mentioned, try with SQLPlus first. If you can make it work with SQLPlus getting it to work with cx_Oracle should be easy enough.
As @cjbj mentioned, try with SQL_Plus first. If you can make it work with SQL_Plus getting it to work with cx_Oracle should be easy enough.
Thanks, I forgot to mention that we are trying with SQL Plus and get the same error message.
@exzizt then it isn't a cx_Oracle problem :) I recommend you open a new question on OTN or Stackoverflow with all yours details (platforms, versions, whether you have SQLNET.AUTHENTICATION_SERVICES
set in a sqlnet.ora file, what does work and what doesn't work etc).
if you're struggling with this issue and are on a windows system, add the following environment variables oracle_home, oracle_sid and tns_admin (pointing to your oracle_home/network/admin) folder
For future readers: if you're using Instant Client then don't set those! Also ORACLE_HOME/network/admin is the default network location if cx_Oracle is linked with the libraries in the DB installation so you shouldn't need to set TNS_ADMIN.
Fix for Mac
I was able to resolve this by copying sqlnet.ora and tnsnames.ora from the wallet dir to instantclient_19_8/networking/admin dir.
Also, replace the default "?/network/admin" with the actual path of the wallet dir in sqlnet.ora.
Also, used the below:
cx_Oracle.init_oracle_client(lib_dir="instantclient_19_8 path")
I am able to connect with Oracle Db using JDBC String in Sql developer but When I tried to connect with DB using cx_Oracle. I'm getting ORA-28759: failure to open file
Cut and paste text showing the command you ran. No screenshots. Use a gist for long screen output and logs: see https://gist.github.com/.
Code:
import cx_Oracle as cx dsn_tns='(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = tcps) (HOST = )(PORT = ))) (CONNECT_DATA = (SERVICE_NAME = ***)))' conn = cx.connect(user=USER, password=PW, dsn=dsn_tns) print(cx.version)
And:
output: platform.platform: Darwin-18.7.0-x86_64-i386-64bit sys.maxsize > 2**32: True platform.python_version: 3.7.4 cx_Oracle.version: 7.3.0 cx_Oracle.clientversion: (19, 3, 0, 0, 0)