Index: db/backends/dummy/base.py
===================================================================
--- db/backends/dummy/base.py	(revision 2)
+++ db/backends/dummy/base.py	(working copy)
@@ -45,7 +45,7 @@
         super(DatabaseWrapper, self).__init__(*args, **kwargs)
 
         self.features = BaseDatabaseFeatures()
-        self.ops = DatabaseOperations()
+        self.ops = DatabaseOperations(self)
         self.client = DatabaseClient()
         self.creation = BaseDatabaseCreation(self)
         self.introspection = DatabaseIntrospection(self)
Index: db/backends/mysql/base.py
===================================================================
--- db/backends/mysql/base.py	(revision 2)
+++ db/backends/mysql/base.py	(working copy)
@@ -223,7 +223,7 @@
         self.server_version = None
 
         self.features = DatabaseFeatures()
-        self.ops = DatabaseOperations()
+        self.ops = DatabaseOperations(self)
         self.client = DatabaseClient()
         self.creation = DatabaseCreation(self)
         self.introspection = DatabaseIntrospection(self)
Index: db/backends/oracle/base.py
===================================================================
--- db/backends/oracle/base.py	(revision 2)
+++ db/backends/oracle/base.py	(working copy)
@@ -137,8 +137,7 @@
     def regex_lookup(self, lookup_type):
         # If regex_lookup is called before it's been initialized, then create
         # a cursor to initialize it and recur.
-        from django.db import connection
-        connection.cursor()
+        self.connection.cursor()
         return connection.ops.regex_lookup(lookup_type)
 
     def sql_flush(self, style, tables, sequences):
@@ -231,7 +230,7 @@
         super(DatabaseWrapper, self).__init__(*args, **kwargs)
 
         self.features = DatabaseFeatures()
-        self.ops = DatabaseOperations()
+        self.ops = DatabaseOperations(self)
         self.client = DatabaseClient()
         self.creation = DatabaseCreation(self)
         self.introspection = DatabaseIntrospection(self)
Index: db/backends/postgresql/base.py
===================================================================
--- db/backends/postgresql/base.py	(revision 2)
+++ db/backends/postgresql/base.py	(working copy)
@@ -89,7 +89,7 @@
         super(DatabaseWrapper, self).__init__(*args, **kwargs)
 
         self.features = DatabaseFeatures()
-        self.ops = DatabaseOperations()
+        self.ops = DatabaseOperations(self)
         self.client = DatabaseClient()
         self.creation = DatabaseCreation(self)
         self.introspection = DatabaseIntrospection(self)
Index: db/backends/postgresql/operations.py
===================================================================
--- db/backends/postgresql/operations.py	(revision 2)
+++ db/backends/postgresql/operations.py	(working copy)
@@ -8,13 +8,13 @@
 # used by both the 'postgresql' and 'postgresql_psycopg2' backends.
 
 class DatabaseOperations(BaseDatabaseOperations):
-    def __init__(self):
+    def __init__(self, *args):
         self._postgres_version = None
+        return super(DatabaseOperations, self).__init__(*args)
 
     def _get_postgres_version(self):
         if self._postgres_version is None:
-            from django.db import connection
-            cursor = connection.cursor()
+            cursor = self.connection.cursor()
             cursor.execute("SELECT version()")
             version_string = cursor.fetchone()[0]
             m = server_version_re.match(version_string)
Index: db/backends/postgresql_psycopg2/base.py
===================================================================
--- db/backends/postgresql_psycopg2/base.py	(revision 2)
+++ db/backends/postgresql_psycopg2/base.py	(working copy)
@@ -59,7 +59,7 @@
         super(DatabaseWrapper, self).__init__(*args, **kwargs)
         
         self.features = DatabaseFeatures()
-        self.ops = DatabaseOperations()
+        self.ops = DatabaseOperations(self)
         self.client = DatabaseClient()
         self.creation = DatabaseCreation(self)
         self.introspection = DatabaseIntrospection(self)
Index: db/backends/sqlite3/base.py
===================================================================
--- db/backends/sqlite3/base.py	(revision 2)
+++ db/backends/sqlite3/base.py	(working copy)
@@ -126,7 +126,7 @@
         super(DatabaseWrapper, self).__init__(*args, **kwargs)
         
         self.features = DatabaseFeatures()
-        self.ops = DatabaseOperations()
+        self.ops = DatabaseOperations(self)
         self.client = DatabaseClient()
         self.creation = DatabaseCreation(self)
         self.introspection = DatabaseIntrospection(self)
Index: db/backends/__init__.py
===================================================================
--- db/backends/__init__.py	(revision 2)
+++ db/backends/__init__.py	(working copy)
@@ -81,6 +81,9 @@
     a backend performs ordering or calculates the ID of a recently-inserted
     row.
     """
+    def __init__(self, connection):
+        self.connection = connection
+
     def autoinc_sql(self, table, column):
         """
         Returns any SQL needed to support auto-incrementing primary keys, or
