diff --git a/includes/database.inc b/includes/database.inc
index 683ae69..9e513a6 100644
--- a/includes/database.inc
+++ b/includes/database.inc
@@ -129,7 +129,15 @@ function db_set_active($name = 'default') {
     install_goto('install.php');
   }
 
-  if (!isset($db_conns[$name])) {
+  $real_name = $name;
+  // open a dedicated connection for watchdog entries
+  // to ensure that entries are written even if other tables locked
+  if ('dedicated_watchdog_connection' == $name) {
+    $name = 'default';
+  }
+
+  if (!isset($db_conns[$real_name])) {
+
     // Initiate a new connection, using the named DB URL specified.
     if (is_array($db_url)) {
       $connect_url = array_key_exists($name, $db_url) ? $db_url[$name] : $db_url['default'];
@@ -148,13 +156,13 @@ function db_set_active($name = 'default') {
       _db_error_page("The database type '". $db_type ."' is unsupported. Please use either 'mysql' or 'mysqli' for MySQL, or 'pgsql' for PostgreSQL databases.");
     }
 
-    $db_conns[$name] = db_connect($connect_url);
+    $db_conns[$real_name] = db_connect($connect_url);
   }
 
   $previous_name = $active_name;
   // Set the active connection.
-  $active_name = $name;
-  $active_db = $db_conns[$name];
+  $active_name = $real_name;
+  $active_db = $db_conns[$real_name];
 
   return $previous_name;
 }
diff --git a/modules/dblog/dblog.module b/modules/dblog/dblog.module
index 4a1326c..f113181 100644
--- a/modules/dblog/dblog.module
+++ b/modules/dblog/dblog.module
@@ -129,7 +129,7 @@ function _dblog_get_message_types() {
  * Implementation of hook_watchdog().
  */
 function dblog_watchdog($log = array()) {
-  $current_db = db_set_active();
+  $current_db = db_set_active('dedicated_watchdog_connection');
   db_query("INSERT INTO {watchdog}
     (uid, type, message, variables, severity, link, location, referer, hostname, timestamp)
     VALUES
