<p>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 password?</p>

<p>Whenever I try to specify and IP address, it seems to be taking it locally.</p>

<p>In other words, how should the string for cx_Oracle.connect() be formatted to a non local database?</p>

<p>There was a previous post which listed as an answer connecting to Oracle via cx_Oracle module with the following code:</p>

<pre><code>#!/usr/bin/python

import cx_Oracle
connstr='scott/tiger'
conn = cx_Oracle.connect(connstr)
curs = conn.cursor()

curs.execute('select * from emp')
print curs.description
for row in curs:
    print row
conn.close()
</code></pre>

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).