cx_Oracle & Connecting to Oracle DB Remotely

后端 未结 6 1965
伪装坚强ぢ
伪装坚强ぢ 2020-11-28 04:59

How do you connect to a remote server via IP address in the manner that TOAD, SqlDeveloper, are able to connect to databases with just the ip address, username, SID and pass

6条回答
  •  野性不改
    2020-11-28 05:28

    import cx_Oracle
    dsn = cx_Oracle.makedsn(host='127.0.0.1', port=1521, sid='your_sid')
    conn = cx_Oracle.connect(user='your_username', password='your_password', dsn=dsn)
    conn.close()
    

提交回复
热议问题