-
Couldn't load subscription status.
- Fork 363
Closed
Labels
Description
I wrote a connect.py script to execute in Python version 2.7 in our server. it's throwing an error below
NameError: name 'connect' is not defined
Script (Connect.py)
import cx_Oracle
import print_function
import sys
import db_config
conn_str='user/password@XXXd'
try:
conn = cx_Oracle.connect(conn_str)
c=conn.cursor()
c.execute('select * from table where rownum < 10')
for row in c:
print(row)
conn.close()
except Exception as e:
print(e)output
>>> connect.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'connect' is not defined
Environment: Exadata Oracle DB 12c.
Client : Oracle 12.2 (64-bit)
Linux version: RHEL 7.1