server/sources/native.py
branchstable
changeset 5606 61b28589d33f
parent 5542 a8ad3df5a8a3
parent 5605 2604545d7dd9
child 5625 6ee2a7b6f194
--- a/server/sources/native.py	Fri May 28 08:05:17 2010 +0200
+++ b/server/sources/native.py	Sat May 29 10:18:02 2010 +0200
@@ -444,6 +444,15 @@
             self.warning("trying to reconnect")
             session.pool.reconnect(self)
             cursor = self.doexec(session, sql, args)
+        except (self.DbapiError,), exc:
+            # We get this one with pyodbc and SQL Server when connection was reset
+            if exc.args[0] == '08S01':
+                self.warning("trying to reconnect")
+                session.pool.reconnect(self)
+                cursor = self.doexec(session, sql, args)
+            else:
+                raise
+            
         results = self.process_result(cursor, cbs)
         assert dbg_results(results)
         return results