Почему я получаю эту ошибку подключения к базе данных Python? - PullRequest
0 голосов
/ 01 мая 2019

Ошибка: tns: слушатель не получил имя_сервиса в connect_data

import cx_Oracle
con = cx_Oracle.connect('hr/hr@localhost')
if  con!= None:
    print('Connection established successfully')
    print('Version:',con.version)
else:
    print('Connection not established')
con.close()

1 Ответ

0 голосов
/ 01 мая 2019
import cx_Oracle
con = cx_Oracle.connect('hr/hr@localhost:1521/orcl')
if  con!= None:
    print('Connection established successfully')
    print('Version:',con.version)
else:
    print('Connection not established')
con.close()
...