I have an Always Free Anonymous Database from Oracle and I'm trying to connect to it in Python using cx_Oracle.
Here is my code:
import cx_Oracle as cx
#getting the instant client
currentpath = os.path.dirname(os.path.abspath(__file__))
clientpath = os.path.join(currentpath, "instantclient_19_11")
cx.init_oracle_client(lib_dir=clientpath)
#easy connect string
connect_string = "tcps://adb.uk-london-1.oraclecloud.com/t3ulea4zs7iolax_db202008251748_high.atp.oraclecloud.com?wallet_location=/Users/georg/Downloads/Wallet&retry_count=20&retry_delay=3"
userpwd = "(my password)"
def dbConnect():
con = cx.connect("ADMIN", userpwd, connect_string, encoding="UTF-8")
print("connection successful")
return con
con = dbConnect()
The error message I get is:
cx_Oracle.DatabaseError: ORA-12506: TNS:listener rejected connection based on service ACL filtering
This is confusing to me as my database is set to allow secure access from anywhere:
"Access Type: Allow secure access from everywhere"
I'm really not sure what I'm doing wrong. Any help is appreciated. If any more information is needed, please let me know.
TNS_ADMIN
environment variable to the location of your wallet files, then use general TNS entry on connection. I've used it this way:db.connect(os.environ["ora_cloud_usr"], os.environ["ora_cloud_pwd"], "test_low", encoding="UTF-8" )
. – astentxora_cloud_usr
andora_cloud_pwd
respectively. Just replace them with actual username and password. – astentx