cammil
cammil

Reputation: 9939

How do I connect to Oracle 10 from pyodbc?

I have "Oracle in OraClient10g" and "Microsoft ODBC for oracle" drivers (checked using ODBCAD32.EXE).

Is there a way to connect to the oracle database with pyodbc?

Upvotes: 2

Views: 9269

Answers (1)

Michał Niklas
Michał Niklas

Reputation: 54332

I use Oracle drivers with DSN and for me it connects:

db = pyodbc.connect('DSN=my_test_db;PWD=tiger')

print('-' * 20)
try:
    c = db.cursor()
    rs = c.execute("select * from v$version where banner like 'Oracle%'")
    for txt in c.fetchall():
        print('%s' % (txt[0]))
finally:
    db.close()

Upvotes: 1

Related Questions