pyodbc.Error: ORA-12560: TNS:protocol adapter error (12560) (SQLDriverConnect) in python. But i am able to connect using sqlplus

北战南征 提交于 2019-12-11 17:16:47

问题


I am able to connect to oracle DB using following commands in sqlplus

     sqlplus user/pass@pdw1s_default

     Connected to:
     Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

and tnsping works properly

     tnsping pdw1s_default

I tried to connect to oracle using python and i tried below connection strings. But I am getting same error. Both Oracleclient and python is 32bit version.

    Driver={Oracle in OraClient12Home1};dbq = pdw1s_default;Uid=user;Pwd=pass;

    Driver={Oracle in OraClient12Home1};DBQ={(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=port)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=pdw1s_default)))};Uid=user;Pwd=pass;

    Driver={Oracle in OraClient12Home1};Server={(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=host)(PORT=port)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=pdw1s_default)))};Uid=user;Pwd=pass;

I also set TNS_ADMIN in the environment variables and TNS_HOME in the registry. Can anyone please help me and provide the list of registry values which I have to create.

Error:

pyodbc.Error: ('HY000', '[HY000] [Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error\n (12560) (SQLDriverConnect);

来源:https://stackoverflow.com/questions/57405385/pyodbc-error-ora-12560-tnsprotocol-adapter-error-12560-sqldriverconnect-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!