cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in con

created at 06-21-2022 views: 77

python connection oracle error

cx_Oracle.DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

reason

import cx_Oracle #Import module
con= cx_Oracle.connect('username', 'password', 'database ip/service name') #Create a connection
Curs=con.cursor() #Create a cursor
sql = '' #The sql you wrote
sql_conn = curs.execute(sql) #Execute sql statement
result = curs.fetchone() #Get a piece of data
print(result) # print data
curs.close() #Close the cursor
con.close() #Close the database connection

configure

created at:06-21-2022
edited at: 06-21-2022: