Skip to content

Connect.py not working -  #286

@ravi2948

Description

@ravi2948

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

Client : Oracle 12.2 (64-bit)
Linux version: RHEL 7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions