python 连接 oracle的一个小

发布时间:2019-09-09 08:43:12编辑:auto阅读(1778)

    #!/usr/bin/python
    #conding=utf-8


    #import module


    import cx_Oracle as oracle


    db=oracle.connect('user/password@192.168.0.103:1521/orcl')
    cursor=db.cursor()
    cursor.execute("select * from student")
    rs=cursor.fetchall()


    for row in rs:
        print ('ID=%d,name=%s'%(row[0],row[1]))
    cursor.close()


    db.close()

关键字