diff --git a/modules/Bio/EnsEMBL/Registry.pm b/modules/Bio/EnsEMBL/Registry.pm
index 87144e1e7f9a3b69e1c8bc4f2ff58e10541b3b29..3c252467bd048de23fd213c2aafff27b8df77fe5 100644
--- a/modules/Bio/EnsEMBL/Registry.pm
+++ b/modules/Bio/EnsEMBL/Registry.pm
@@ -2598,7 +2598,7 @@ SECONDLOOP:
       }
 
       my $dbh = $dbc->db_handle();
-      my $dbhost = $dbc->host();
+      my $dbname = $dbc->dbname();
 
       foreach my $type ( 'Gene', 'Transcript', 'Translation', 'Exon' ) {
         my $statement =
@@ -2606,7 +2606,7 @@ SECONDLOOP:
                      . "FROM %s "
                      . "WHERE stable_id = ?",
                    $dbh->quote_identifier(
-                     undef, $dbhost,
+                     undef, $dbname,
                      sprintf( "%s_stable_id", lc($type) ) ) );
 
         my $sth = $dbh->prepare($statement);