Re: [cx-oracle-users] ping()
Brought to you by:
atuining
From: <prz...@po...> - 2011-01-18 09:27:05
|
Hi all, According to your recommendations I have changed the source: ... import cx_Oracle import sys from time import gmtime, strftime tmp_ex = 0 try: con = cx_Oracle.connect('...') cs = con.cursor() cs.execute ("select 1 from dual") con.rollback () con.close() STATUS = "UP" except cx_Oracle.Error as ex: tmp_ex = ex STATUS = "DOWN" print strftime("%Y-%m-%d %H:%M:%S", gmtime()), STATUS, tmp_ex Now I have: ... 2011-01-18 01:13:01 UP 0 2011-01-18 01:14:02 UP 0 2011-01-18 01:15:01 DOWN ORA-12541: TNS:no listener 2011-01-18 01:16:01 DOWN ORA-12541: TNS:no listener 2011-01-18 01:17:01 DOWN ORA-12541: TNS:no listener 2011-01-18 01:18:02 DOWN ORA-12541: TNS:no listener 2011-01-18 01:19:01 DOWN ORA-12541: TNS:no listener 2011-01-18 01:20:01 DOWN ORA-12541: TNS:no listener 2011-01-18 01:21:04 DOWN ORA-12543: TNS:destination host unreachable 2011-01-18 01:22:05 DOWN ORA-12543: TNS:destination host unreachable 2011-01-18 01:23:04 DOWN ORA-12543: TNS:destination host unreachable 2011-01-18 01:24:04 DOWN ORA-12543: TNS:destination host unreachable 2011-01-18 01:25:04 DOWN ORA-12543: TNS:destination host unreachable 2011-01-18 01:26:01 DOWN ORA-12541: TNS:no listener 2011-01-18 01:27:01 DOWN ORA-12541: TNS:no listener 2011-01-18 01:28:01 DOWN ORA-12541: TNS:no listener 2011-01-18 01:29:02 UP 0 2011-01-18 01:30:02 UP 0 ... It seems to work. Thank you :-) Regards Przemyslaw Bak (przemol) -- http://przemol.blogspot.com/ ---------------------------------------------------------------- Nie pĹaÄ ksiÄgowej! Odbierz prezent. SprawdĹş >> http://linkint.pl/f28f6 |