Forum Stats

  • 3,876,133 Users
  • 2,267,067 Discussions
  • 7,912,446 Comments

Discussions

cx_oracle ping (OCIPing) hangs when connection to server lost

664229
664229 Member Posts: 2
edited Oct 9, 2008 12:57AM in Python
The cx_oracle ping function appears to be blocking and will wait forever when the connection to the database is broken but the socket still remains.

we're running cx_oracle 4.4 on an Oracle 11.1 server with python 2.5, and have a remote client pushing data to the server across a flakey link.
The basic structure of our python client is

db = cx_Oracle.connect()
while True:
try:
db.ping()
cursor = cx_Oracle.Cursor(db)
cursor.execute(query, params)
except:
print "DB error"

so the socket pointer will be there which is checked in the ping command, so it will pass that, but then it will attempt to issue a ping to the server which is where it hangs forever.
Any advice on the best way to get around this?

Answers

This discussion has been closed.