我使用Docker在本地主機(主機)上運行虛擬Oracle數據庫服務器。使用python訪問oracleDB時出錯
當我在shell(bash)中使用它時,它工作的很好。
但是我想讓它從python界面訪問。
cx_Oracle安裝(Python接口用於Oracle),
,但它不是我的Python代碼訪問(jupyter筆記本)。 代碼如下
import cx_Oracle
con = cx_Oracle.connect("system/[email protected]:8080")
錯誤代碼那麼簡單:
DatabaseError Traceback (most recent call last)
<ipython-input-8-681e47c38e7c> in <module>()
----> 1 con = cx_Oracle.connect("system/[email protected]:8080")
DatabaseError: ORA-12537:
雖然您正在使用的'easy connect'連接字符串語法有多種默認值,但它們並不常見。你可能只需要找到數據庫的「服務名稱」,幷包括:'con = cx_Oracle.connect(「system/oracle @ localhost:8080/whateveryourservicenameis」)' –