server/sources/native.py
changeset 5627 a7e40cccdc9b
parent 5557 1a534c596bff
parent 5625 6ee2a7b6f194
child 5655 ef903fff826d
--- a/server/sources/native.py	Tue Jun 01 08:34:35 2010 +0200
+++ b/server/sources/native.py	Wed Jun 02 13:02:47 2010 +0200
@@ -444,7 +444,15 @@
             self.warning("trying to reconnect")
             session.pool.reconnect(self)
             cursor = self.doexec(session, sql, args)
-        results = self.process_result(cursor, cbs)
+        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, session=session)
         assert dbg_results(results)
         return results