Search code examples
pythonubuntuoracle9i

connect to oracle9i using python2.7 on ubuntu 64bit


OS: Ubuntu 13.10 64bit Python : 2.7.5 Oracle Database : Oracle 9i (remote)

how to connect to oracle using python?


Solution

  • I was able to connect to Oracle successfully using the cx_Oracle module. (CentOs 5.9, Python 2.7.5, Oracle 10)

    The code would be something similar to:

    import cx_Oracle
    
    dsn = cx_Oracle.makedsn(host, port, sid)
    db = cx_Oracle.connect(user, password, dsn)
    

    After connecting to Oracle, you can create a Cursor object to make queries.