diff -bur -x '*.pyc' sqlobject_orig/dbconnection.py sqlobject/dbconnection.py
--- sqlobject_orig/dbconnection.py	2006-12-18 12:12:54.000000000 +0100
+++ sqlobject/dbconnection.py	2006-12-30 15:40:03.471446400 +0100
@@ -226,6 +226,19 @@
 
     def _runWithConnection(self, meth, *args):
         conn = self.getConnection()
+
+        try:
+            import MySQLdb
+            conn.ping()
+        except ImportError:
+            pass # No MySQLdb module installed.
+        except AttributeError:
+            pass # SQLite connections have not ping() method.
+        except MySQLdb.OperationalError, e:
+            if e.args[ 0 ] in ( 2006, 2013 ): # SERVER_GONE or SERVER_LOST error
+                print 'reconnecting because of', e
+                conn = self.makeConnection()
+
         try:
             val = meth(conn, *args)
         finally:
