So I'm trying to establish a connection to a remote Oracle Database in python, from a Linux CentOS machine, but I'm getting the error- cx_Oracle.DatabaseError: ORA-12170: TNS:Connect timeout occurred.
I'm using a virtual environment to run my code, wherein I have installed the cx-Oracle==8.3.0. My python version is 3.6.2 and below is my code
import cx_Oracle
username ="username" password ="password"
tns_dsn = cx_Oracle.makedsn("examplehost.com", 1528, "SID")
connection = cx_Oracle.connect( username, password, tns_dsn)
print(connection.version)
I've also tried connection = cx_Oracle.connect("username/password@examplehost.com:1528/SID") and possibly many other ways of connecting to the database, all have given me the same error.
I read other similar questions, some said to modify tnsnames.ora which I can't find anywhere on the system, as I'm using a virtual to implement this.
Please let me know where I'm going wrong or if I'm missing something.
Thanks