INSERT not working in cx_oracle when used with execute. How to get it working?

喜你入骨 提交于 2019-12-02 02:57:22
Venu Murthy

How can cursor.commit work when the methods in Cursor do not have commit, connections has this method and hence it should be:

    connection.commit()

Using cursor.commit() returns:
AttributeError: 'cx_Oracle.Cursor' object has no attribute 'commit'

Strange that you are not getting an error with that code; that's of course unless you are (sadly) calling the Cursor object, connect.

You need to have something like this somewhere, before all your code:

conn = cx_Oracle.connect(usr, pwd, url)
cursor = conn.cursor()

Proceed then to replace connect.execute(sqlcode) with cursor.execute(sqlcode).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!