Good day. We are upgrading a legacy system from Sybase to Postgres. In one of the modules, we wish, if an SQLException is caught, to close and reopen the connection and retry - but only if the cause of the Exception is a dropped connection. The original developer of the code implemented this by searching for the substrings "Broken pipe" or "Connection already closed" in the exception message. Is there a more elegant way to find out whether the connection has been dropped from within the catch clause? And if not, I assume the above substrings are no longer pertinent - what messages in PostgreSQL indicate a dropped connection? Thank you, Herouth
Herouth Maoz wrote: > Is there a more elegant way to find out whether the connection has been > dropped from within the catch clause? Test the SQLState of the thrown SQLException. See http://www.postgresql.org/docs/8.4/static/errcodes-appendix.html -O
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера