cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Solution 1
Please use this as your connection string :
connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER', 'hdgf_76trf',
cx_Oracle.makedsn('10.245.63.34',1825,'FRDLD2D1') );
Changing SID = FRDLD2D1
to SERVICE_NAME = FRDLD2D1
in your TNSNAMES.ORA
file may be an alternative.
Solution 2
You just make dsn in python without config file (tnsnames.ora)
dsn = cx_Oracle.makedsn(host='10.245.63.34', port=1825, sid='FRDLD2D1')
con = cx_Oracle.connect(user='PNTH_LOGGINGB_OWNER', password='password', dsn=dsn)
Vijay
Over Ten years of solid experience as a Linux Administrator and into various streams like Hadoop, Bigdata Analytics with Tools implementation like Cloudera DataScience Workbench, Neo4j graph database, Elastic search, and Lavastorm implementation. Path which I come across have manipulated different kind of scenarios with respect to the realms mentioned above. Automation knowledge using configuration management tools like Ansible. Knowledge on cloud platforms like Amazon EC2, have had worked extensively on Cloud platform for server provisioning, implementing security groups all that. Dealt with various Linux & Unix flavored servers. Good scripting skills to automate things. Have dealt with Hadoop cluster issues using Cloudera Manager, Spark issues with respect to YARN queues, and Upgrade of Hadoop clusters using Cloudera Manager. Kerebros configuration with the cluster, and Hadoop user creation, maintenance. Knowledge on web servers like, Jetty, Apache, Tomcat. Performance tuning with PostgreSQL database. Hot & Warm standby with PG-Pool mechanism for PostgreSQL database. Dealt with PostgreSQL backups using scripts. Housekeeping servers using scripts. Had worked on VMWare VC on node creation, configuration change and did troubleshoot the Virtual Machine issues. Shell scripting for automated DB/application/repository(SVN)backups and alert mechanisms. Good work knowledge on Amazon cloud servers & Load balancing between servers (SaaS environment), HA cluster setup between servers.
Updated on June 08, 2022Comments
-
Vijay almost 2 years
I am trying to do a sanity testing of newly installed
Oracle client 12.2 in RHEL 7 linux
from a Python program, but it fails with the above error, not sure what I am missing on there. Please help with this case :cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
my
tnsnames.ora
file under/home
directoryFRDLD2D1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(Host = frdld2d1.de.db.com)(Port = 1825)) ) (CONNECT_DATA = (SID = FRDLD2D1) ) )
and my python program goes below
#!/usr/bin/python import cx_Oracle #connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER/password') connection = cx_Oracle.connect('PNTH_LOGGINGB_OWNER/[email protected]:1825/orcl') cursor = connection.cursor() querystring = "select * from BDR_JOB_MASTER_LOG where ROWNUM <= 1;" cursor.execute(querystring)
frdld2d1.de.db.com
- IP address :10.245.63.34
Appreciate if any points the glitch on here.
tnsping
utility is not there to test since it is an instaclient versionoracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
.But with
SQLPlus
, I am able to connect the database without any issues.