cx_Oracle & Connecting to Oracle DB Remotely

后端 未结 6 1960
伪装坚强ぢ
伪装坚强ぢ 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条回答
  •  萌比男神i
    2020-11-28 05:27

    You can specify the server in the connection string, e.g.:

    import cx_Oracle
    connstr = 'scott/tiger@server:1521/orcl'
    conn = cx_Oracle.connect(connstr)
    
    • "server" is the server, or the IP address if you want.
    • "1521" is the port that the database is listening on.
    • "orcl" is the name of the instance (or database service).

提交回复
热议问题