Connect to Oracle database using pyodbc
<p>I would like to connect to an Oracle database with python through pyodbc. I have installed oracle driver and I tried the following script:</p>

<pre><code>import pyodbc
connectString = """
                DRIVER={Oracle in OraClient12Home1};
                SERVER=some_oracle_db.com:1521;
                SID=oracle_test;
                UID=user_name;
                PWD=user_pass
                """
cnxn = pyodbc.connect(connectString)
</code></pre>

<p>I got the following error message:</p>

<pre><code>cnxn = pyodbc.connect(connectString)

Error: ('HY000', '[HY000] [Oracle][ODBC][Ora]ORA-12560: TNS:protocol adapter error\n (12560) (SQLDriverConnect)')
</code></pre>

<p>What's wrong here?</p>

<p>You have to specify server or hostname (or IP address  in connection string  for your database server is running.</p>

python oracle