如何在 cx_Oracle 中接受包含“@”符号的密码
How to accept password in cx_Oracle which contains '@' symbol
下面是我在 python.
上执行的代码
import cx_Oracle
oracle_url = user/p@ssword@hostname:1521/db_service
cx_Oracle.connect(oracle_url)
它给出错误:ORA-12154:TNS:could 无法解析指定的连接标识符
尝试过的解决方案(适用于 powershell 或 CMD):
- 在我的密码周围添加 "Quotes" 没有帮助。
- 添加 \"Quotes\" 也不起作用。
你试过下面的方法了吗?
如果使用SID,
dsn_tns = cx_Oracle.makedsn('server', 'port', 'sid')
conn = cx_Oracle.connect(user='username', password='password', dsn=dsn_tns)
或者如果使用了 ServiceName
dsn_tns = cx_Oracle.makedsn('server', 'port', service_name='service_name')
conn = cx_Oracle.connect(user='username', password='password', dsn=dsn_tns)
下面是我在 python.
上执行的代码 import cx_Oracle
oracle_url = user/p@ssword@hostname:1521/db_service
cx_Oracle.connect(oracle_url)
它给出错误:ORA-12154:TNS:could 无法解析指定的连接标识符
尝试过的解决方案(适用于 powershell 或 CMD):
- 在我的密码周围添加 "Quotes" 没有帮助。
- 添加 \"Quotes\" 也不起作用。
你试过下面的方法了吗?
如果使用SID,
dsn_tns = cx_Oracle.makedsn('server', 'port', 'sid')
conn = cx_Oracle.connect(user='username', password='password', dsn=dsn_tns)
或者如果使用了 ServiceName
dsn_tns = cx_Oracle.makedsn('server', 'port', service_name='service_name')
conn = cx_Oracle.connect(user='username', password='password', dsn=dsn_tns)