cx_Oracle.DatabaseError: ORA-12514

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cx_Oracle.DatabaseError: ORA-12514相关的知识,希望对你有一定的参考价值。

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

目录

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

问题:

解决:

完整错误:


问题:

填写了错误的database名称;

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, DateTime, Boolean,Float


class OracleDB(object):
    Base = declarative_base()
    def __init__(self,user='xxx',password='xxx',dabatase='xxx',serverip='10.10.10.10',port='1000'):
        user = user #'root'  
        password = password 
        database = dabatase  
        serverip = serverip 
        dns = cx_Oracle.makedsn(serverip, port, service_name=dabatase)
        self.engine = create_engine("oracle://"+user+":"+password+"@" + dns, encoding='utf-8', echo=True)
        # Session = sessionmaker(bind=self.engine)
        # self.session = Session()
    def getEngine(self):
        return self.engine

解决:

填写正确的database名称;

data=
        (DESCRIPTION=
            (ADDRESS_LIST=
                (ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521))
            )
            (CONNECT_DATA=
                (SERVICE_NAME=machine_learning_database)
            )
        )

完整错误:

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

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

参考:ORA-12514: TNS:listener does not currently know of service requested in connect descriptor 

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

以上是关于cx_Oracle.DatabaseError: ORA-12514的主要内容,如果未能解决你的问题,请参考以下文章

python 3.6 cx_Oracle.DatabaseError: DPI-1050

(cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library:

python用cx_Oracle连接数据库,出现错误cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client li

cx_Oracle.DatabaseError: ORA-28759: failure to open file

Linux下使用Python连接Oracle 报cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be lo

已经配好64位的oracle instantclient,依旧Python报错cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Ora