cx_Oracle Module

来源:互联网 发布:lrc字幕制作软件 编辑:程序博客网 时间:2024/06/07 07:28

      cx_Oracle is a Python extension module that allows access to Oracle databasesand conforms to the Python database API specification. To use it, you just need to download the version which matches your Oracle client version and python version and setup as the instructions. For Oracle 10g, you need to install the Release 10.2.0.1.0.

 

    1. Connect to a database.

 

    import cx_Oracle

    conn = cx_Oracle.connect('username/password@TNS Name')

 

    2. Execute a sql.

 

    curs = conn.cursor()

    curs.execute(sql)

 

    3. Fetch the result.

 

    curs.fetchall() or curs.fetchone()

 

    4. Excute insert, update.

 

     curs.executmany()

 

More usage, please refer to: http://www.oracle.com/technology/global/cn/pub/articles/devlin-python-oracle.html

 

原创粉丝点击