Why does insert script using cx_Oracle hangs

Viewed 1339

I'm new to Python, using cx_Oracle.execute to insert a row into a table.

I prepare the insert statement, which works on SQL developer.

print statements prior to the execute indicate it hangs on execute. A simple select statement works using the same package.

  • Python version is 2.7
  • Oracle version is 11g
  • cx_Oracle version is 5.2.1
  • Eclipse is 4.4.2
  • Pydev is 4.5.5

I have tried this on Anaconda as well, same result.

import cx_Oracle

Connection = cx_Oracle.connect('connectioninfo')
cursor = connection.cursor()
print(cx_Oracle.__file__) 
print(cx_Oracle._version)

sql1 = "insert into date_dim(dateid) values (20170523)"
print(sql1)
cursor.execute(sql1) # hangs here 
count = cursor.rowcount 

print(count)
connection.commit() # Never gets to this statement        
cursor.close()
connection.close()
1 Answers
Related