I am attempting to connect to an Oracle Database using Python cx_Oracle package and Oracle instantclient_19_8. I keep getting this error - OORA-29024: Certificate validation failure.
- I downloaded and installed Oracle InstantClient_19_8.
- Within the [...]instantclient_19_8/network/admin directory, I copied the cwallet.sso and ewallet.p12 files I received from a DBA.
- I created a sqlnet.ora file in the network/admin directory:
WALLET_LOCATION = (SOURCE = (METHOD = FILE) (METHOD_DATA = (DIRECTORY = /instantclient_19_8/network/admin) ) ) SQLNET.WALLET_OVERRIDE = TRUE
- I created a tnsnames.ora file in the network/admin diretory (though this might not be necessary):
ora_conn = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCPS) (HOST = {HOST}) (PORT = 1525) ) ) (CONNECT_DATA = (SERVICE_NAME = {SVC_NAME) ) )
- In Pycharm, I set the TNS_ADMIN environment variable and pointed it to [...]/instantclient_19_8/network/admin.
My Python connection info is:
dsn=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCPS)(HOST={HOST_ADDRESS})(PORT={PORT_NBR})))(CONNECT_DATA=(SERVICE_NAME={SVC_NAME})))
cx_Oracle.init_oracle_client(lib_dir='[...]/instantclient_19_8')
ora_conn = cx_Oracle.connect(user=usr
, password=pw
, dsn=dsn
, encoding="UTF-8")
cursor = ora_conn.cursor()
I've seen several blog posts about using orapki, but it is not clear how to use orapki with instant client. If the DBA created the wallet, are they the only ones who can add a cert file to the wallet? Or, would I be able to if I got orapki to work?
Any suggestions/guidance would be great!
Thank you!