Skip to content Skip to sidebar Skip to footer

Insert Not Working In Cx_oracle When Used With Execute. How To Get It Working?

I am new to cx_oracle. I have established a connection and I am able to create and drop a table using execute. Where I am failing is when I try to use 'INSERT INTO ...' in execute.

Solution 1:

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'

Solution 2:

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).

Post a Comment for "Insert Not Working In Cx_oracle When Used With Execute. How To Get It Working?"