Python3 怎么连接Oracle10数据库?


尝试使用python3连接Oracle10数据库但是失败了,报错:

C:\Users\Administrator\AppData\Local\Programs\Python\Python36\python.exe "E:/Program Files/JetBrains/PycharmProjects/PythonDemo1/PyOracle2.py" Traceback (most recent call last): File "E:/Program Files/JetBrains/PycharmProjects/PythonDemo1/PyOracle2.py", line 4, in <module> conn = cx_Oracle.connect("user1/123123@127.0.0.1:1521/orcl", encoding='utf-8') UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 95-96: invalid continuation byte

Process finished with exit code 1

代码: conn = cx_Oracle.connect("user1/123123@127.0.0.1:1521/orcl", encoding='utf-8') cur = conn.cursor() cur.execute("select sysdate from dual") row = cur.fetchone() for f in row: print(f) cur.close() conn.close()

  • 目前还没有回复
添加一条新回复
登录 或者 注册 后发表回复