Re: [cx-oracle-users] How to transparently re-connect using cx_Oracle?
Brought to you by:
atuining
From: Laurelin of M. E. <la...@fn...> - 2006-10-05 17:53:55
|
Thus spaketh Anthony Tuininga on 10/05/2006 11:23 AM: > On 10/4/06, Laurelin of Middle Earth <la...@fn...> wrote: > >> [snippage] >>Unless the cx_Oracle.Connection instance knows how to reconnect >>itself.... > > > It doesn't currently -- but its entirely possible that it could. Of > course any current cursors would be invalidated by such a move. That > might end up causing more trouble than its worth.... As has already > been noted attempting to restart something in the middle may not be > very effective as well. Are you certain that this is the solution you > need and would a reconnect() method help you? Would you need this > "right away" as well? > My RetryHandler knows about certain "transactions" -- that is, things that require both "execute" (or "callfunc") and a series of one or more "fetchXXX" calls. If any of the elements fails, it will go back to the beginning of the transaction. So I think I've handled the case of "restarting something in the middle", at least for the situations of interest to me. As for invalidating current cursors... hmmm.... I guess I don't understand (but that's not unusual ;-). My hope was that the cursor would become "usable" again by re-connecting its existing connection rather than creating a new connection. Of course you cannot continue with anything that you are currently executing in that cursor -- but if the connection is dead, then the cursor can't be doing much of anything anyway, right? In my case, what I was hoping could happen would be something along the lines of the pseudo-code: done = False while not done: try: cursor.callfunc(...) cursor.do_whatever_fetch_XXX(...) done = True except ConnectionIsDeadException: cursor.connection.reconnect() except RetriableException: pass "Right away"? Yes, of course -- yesterday would be optimal. ;-) No, we have a workaround that is getting us by for the time being, and I'm not presumptuous enough to think that you have free time to spend on solving my problems. "At your convenience (but the sooner the better)" is just fine. Thanks, lauri |