I'm trying to connect to Oracle using using the following Python script:
import oracledb
connection = oracledb.connect(user = 'user',
password = 'PW',
service_name = 'xxx')
However, I am getting the following error:
OperationalError: DPY-6005: cannot connect to database (CONNECTION_ID=KKNOzerEHqa1cFi8jN5yWw==). [WinError 10061] No connection could be made because the target machine actively refused it
If I had to guess I am putting in the incorrect service_name. I know what the TNS service name is and Database service names are, but I'm not sure if these are what I need to enter. Provided these are correct, its not clear what exactly I would enter here, e.g. service_name = 'local/service name'
or simply just enter the service name excluding 'local/'.
Finally, I usually connect to my work database using a JDBC custom url connection e.g. "jdbc:oracle:thin:@ldap://ldaptns...". Does anyone know if it possible to utilise this in oracledb.connect()
?
Thanks
You need to specify the host, as John Gordon noted. Like this: