diff --git a/docs/en_US/images/preferences_debugger_display.png b/docs/en_US/images/preferences_debugger_display.png
index 30962d97014bdd9b7379c195eb4fa29765f6894f..0bb7c92e32e2ec31520142733f97500ea5d65ff1 100644
GIT binary patch
diff --git a/docs/en_US/images/preferences_sql_display.png b/docs/en_US/images/preferences_sql_display.png
index b9ecbc4d495e3f6a077042723ad9ee7e5a4d043e..257e21d7fad936fafac1a1a96a7330c31f57c502 100644
GIT binary patch
diff --git a/docs/en_US/preferences.rst b/docs/en_US/preferences.rst
index e643dd4..ab5c2bb 100644
--- a/docs/en_US/preferences.rst
+++ b/docs/en_US/preferences.rst
@@ -159,6 +159,8 @@ Expand the *Debugger* node to specify your debugger display preferences.
     :alt: Preferences dialog debugger display options
     :align: center
 
+* Use *Debugger tab title placeholder* field to customize the Debugger tab title.
+
 * When the *Open in new browser tab* switch is set to *True*, the Debugger will
   open in a new browser tab when invoked.
 
@@ -284,6 +286,10 @@ Tool display.
   a positive value above zero is specified, the notifier will be displayed for
   the specified number of seconds. The default is *5*.
 
+* Use the *Query tool tab title placeholder* field to customize the query tool tab title.
+
+* Use *View/Edit tab title placeholder* field to customize the View/Edit Data tab title.
+
 .. image:: images/preferences_sql_editor.png
     :alt: Preferences dialog sqleditor editor settings
     :align: center
diff --git a/web/pgadmin/static/js/sqleditor/new_connection_dialog.js b/web/pgadmin/static/js/sqleditor/new_connection_dialog.js
index dbce9d7..10850e1 100644
--- a/web/pgadmin/static/js/sqleditor/new_connection_dialog.js
+++ b/web/pgadmin/static/js/sqleditor/new_connection_dialog.js
@@ -17,7 +17,7 @@ import newConnectionDialogModel from 'sources/sqleditor/new_connection_dialog_mo
 
 
 let NewConnectionDialog = {
-  'dialog': function(handler, reconnect) {
+  'dialog': function(handler, reconnect, preferences) {
     let url = url_for('sqleditor.get_new_connection_data', {
       'sid': handler.url_params.sid,
       'sgid': handler.url_params.sgid,
@@ -199,10 +199,26 @@ let NewConnectionDialog = {
                 }
               });
               let tab_title = '';
-              if(newConnCollectionModel['role']) {
-                tab_title = selected_database_name + '/' + newConnCollectionModel['role'] + '@' + response.server_name;
-              } else {
-                tab_title = selected_database_name + '/' + newConnCollectionModel['user'] + '@' + response.server_name;
+
+              var qt_title_placeholder = preferences['qt_tab_title_placeholder'];
+              var placeholders = qt_title_placeholder.split('%');
+              placeholders.forEach(function(placeholder) {
+                if(placeholder == 'DATABASE'){
+                  tab_title = tab_title.concat(selected_database_name);
+                } else if(placeholder == 'USERNAME') {
+                  if(newConnCollectionModel['role']) {
+                    tab_title = tab_title.concat(newConnCollectionModel['role']);
+                  } else {
+                    tab_title = tab_title.concat(newConnCollectionModel['user']);
+                  }
+                } else if(placeholder == 'SERVER') {
+                  tab_title = tab_title.concat(response.server_name);
+                } else{
+                  tab_title = tab_title.concat(placeholder);
+                }
+              });
+
+              if(!newConnCollectionModel['role']) {
                 newConnCollectionModel['role'] = null;
               }
 
@@ -212,12 +228,6 @@ let NewConnectionDialog = {
                 if(parseInt(connection_data['server']) == newConnCollectionModel['server']
                 && parseInt(connection_data['database']) == newConnCollectionModel['database']
                 && connection_data['user'] == newConnCollectionModel['user'] && connection_data['role'] == newConnCollectionModel['role']) {
-                  is_create_connection = false;
-                  // break for loop by return false.
-                  return false;
-                }
-
-                if(tab_title == connection_data['title']) {
                   is_create_connection = false;
                   return false;
                 }
@@ -236,6 +246,7 @@ let NewConnectionDialog = {
                   'password': response.password,
                   'server_name': _.escape(response.server_name),
                   'database_name': _.escape(selected_database_name),
+                  'is_selected': false,
                 };
                 handler.gridView.on_change_connection(connection_details, self);
               }
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js
index b802a40..f92c64a 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js
@@ -10,7 +10,7 @@
 import {getTreeNodeHierarchyFromIdentifier} from '../../../../static/js/tree/pgadmin_tree_node';
 import gettext from 'sources/gettext';
 
-function getDatabaseLabel(parentData) {
+export function getDatabaseLabel(parentData) {
   return parentData.database ? parentData.database.label
     : parentData.server.db;
 }
@@ -20,6 +20,7 @@ function isServerInformationAvailable(parentData) {
 }
 
 export function getPanelTitle(pgBrowser, selected_item=null) {
+  var preferences = pgBrowser.get_preferences_for_module('sqleditor');
   if(selected_item == null) {
     selected_item = pgBrowser.treeMenu.selected();
   }
@@ -32,7 +33,21 @@ export function getPanelTitle(pgBrowser, selected_item=null) {
 
   const db_label = getDatabaseLabel(parentData);
 
-  return `${db_label}/${_.escape(parentData.server.user.name)}@${parentData.server.label}`;
+  var qt_title_placeholder = preferences['qt_tab_title_placeholder'];
+  var placeholders = qt_title_placeholder.split('%');
+  var title = '';
+  placeholders.forEach(function(placeholder) {
+    if(placeholder == 'DATABASE'){
+      title = title.concat(db_label);
+    } else if(placeholder == 'USERNAME') {
+      title = title.concat(parentData.server.user.name);
+    } else if(placeholder == 'SERVER') {
+      title = title.concat(parentData.server.label);
+    } else{
+      title = title.concat(placeholder);
+    }
+  });
+  return _.escape(title);
 }
 
 export function setQueryToolDockerTitle(panel, is_query_tool, panel_title, is_file) {
diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js
index 8a5071d..401af2b 100644
--- a/web/pgadmin/tools/datagrid/static/js/show_data.js
+++ b/web/pgadmin/tools/datagrid/static/js/show_data.js
@@ -9,7 +9,7 @@
 import gettext from '../../../../static/js/gettext';
 import url_for from '../../../../static/js/url_for';
 import {getTreeNodeHierarchyFromIdentifier} from '../../../../static/js/tree/pgadmin_tree_node';
-import {getPanelTitle} from './datagrid_panel_title';
+import {getDatabaseLabel} from './datagrid_panel_title';
 import CodeMirror from 'bundled_codemirror';
 import * as SqlEditorUtils from 'sources/sqleditor_utils';
 import $ from 'jquery';
@@ -279,16 +279,35 @@ function hasSchemaOrCatalogOrViewInformation(parentData) {
 }
 
 export function generateDatagridTitle(pgBrowser, aciTreeIdentifier) {
-  const baseTitle = getPanelTitle(pgBrowser, aciTreeIdentifier);
-
+  //const baseTitle = getPanelTitle(pgBrowser, aciTreeIdentifier);
+  var preferences = pgBrowser.get_preferences_for_module('sqleditor');
   const parentData = getTreeNodeHierarchyFromIdentifier.call(
     pgBrowser,
     aciTreeIdentifier
   );
 
   const namespaceName = retrieveNameSpaceName(parentData);
-
+  const db_label = getDatabaseLabel(parentData);
   const node = pgBrowser.treeMenu.findNodeByDomElement(aciTreeIdentifier);
 
-  return `${namespaceName}.${node.getData().label}/${baseTitle}`;
+  var dtg_title_placeholder = preferences['vw_edt_tab_title_placeholder'];
+  var placeholders = dtg_title_placeholder.split('%');
+  var title = '';
+  placeholders.forEach(function(placeholder) {
+    if(placeholder == 'DATABASE'){
+      title = title.concat(db_label);
+    } else if(placeholder == 'USERNAME') {
+      title = title.concat(parentData.server.user.name);
+    } else if(placeholder == 'SERVER') {
+      title = title.concat(parentData.server.label);
+    } else if(placeholder == 'SCHEMA') {
+      title = title.concat(namespaceName);
+    } else if(placeholder == 'TABLE') {
+      title = title.concat(node.getData().label);
+    } else{
+      title = title.concat(placeholder);
+    }
+  });
+
+  return _.escape(title);
 }
diff --git a/web/pgadmin/tools/debugger/__init__.py b/web/pgadmin/tools/debugger/__init__.py
index 5130ff0..953ddb2 100644
--- a/web/pgadmin/tools/debugger/__init__.py
+++ b/web/pgadmin/tools/debugger/__init__.py
@@ -85,6 +85,18 @@ class DebuggerModule(PgAdminModule):
                              'will be opened in a new browser tab.')
         )
 
+        self.tab_title = self.preference.register(
+            'display', 'debugger_tab_title_placeholder',
+            gettext("Debugger tab title placeholder"),
+            'text', '%FUNCTION%/%SCHEMA%/%DATABASE%',
+            category_label=PREF_LABEL_DISPLAY,
+            help_str=gettext(
+                'Supported placeholders: FUNCTION, SCHEMA and DATABASE. '
+                'You can also provide any string with or '
+                'without placeholders'
+            )
+        )
+
         self.preference.register(
             'keyboard_shortcuts', 'btn_start',
             gettext('Accesskey (Continue/Start)'), 'keyboardshortcut',
diff --git a/web/pgadmin/tools/debugger/static/js/debugger.js b/web/pgadmin/tools/debugger/static/js/debugger.js
index 362d5d4..b638347 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger.js
@@ -427,6 +427,7 @@ define([
               panel = pgBrowser.docker.addPanel(
                 'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
               );
+            debuggerUtils.setDebuggerTitle(panel, self.preferences, treeInfo.function.label, treeInfo.schema.label, treeInfo.database.label);
 
             panel.focus();
 
@@ -549,6 +550,7 @@ define([
                     panel = pgBrowser.docker.addPanel(
                       'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
                     );
+                  debuggerUtils.setDebuggerTitle(panel, self.preferences, newTreeInfo.function.label, newTreeInfo.schema.label, newTreeInfo.database.label);
 
                   panel.focus();
 
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_ui.js b/web/pgadmin/tools/debugger/static/js/debugger_ui.js
index 161b70a..2caf387 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger_ui.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger_ui.js
@@ -10,9 +10,9 @@
 define([
   'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone',
   'pgadmin.alertifyjs', 'sources/pgadmin', 'pgadmin.browser',
-  'pgadmin.backgrid', 'sources/window', 'wcdocker',
+  'pgadmin.backgrid', 'sources/window', 'pgadmin.tools.debugger.utils', 'wcdocker',
 ], function(
-  gettext, url_for, $, _, Backbone, Alertify, pgAdmin, pgBrowser, Backgrid, pgWindow
+  gettext, url_for, $, _, Backbone, Alertify, pgAdmin, pgBrowser, Backgrid, pgWindow, debuggerUtils
 ) {
 
   var wcDocker = window.wcDocker;
@@ -773,6 +773,7 @@ define([
                         panel = pgBrowser.docker.addPanel(
                           'frm_debugger', wcDocker.DOCK.STACKED, dashboardPanel[0]
                         );
+                      debuggerUtils.setDebuggerTitle(panel, self.preferences, treeInfo.function.label, treeInfo.schema.label, treeInfo.database.label);
 
                       panel.focus();
 
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_utils.js b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
index 27b51ef..5cb157c 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger_utils.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
@@ -42,8 +42,29 @@ function getProcedureId(treeInfoObject) {
   return objectId;
 }
 
+function setDebuggerTitle(panel, preferences, function_name, schema_name, database_name) {
+  var debugger_title_placeholder = preferences['debugger_tab_title_placeholder'];
+  var placeholders = debugger_title_placeholder.split('%');
+
+  var title = '';
+  placeholders.forEach(function(placeholder) {
+    if(placeholder == 'FUNCTION'){
+      title = title.concat(function_name);
+    } else if(placeholder == 'SCHEMA'){
+      title = title.concat(schema_name);
+    } else if(placeholder == 'DATABASE'){
+      title = title.concat(database_name);
+    } else{
+      title = title.concat(placeholder);
+    }
+  });
+  panel.title('<span>'+ _.escape(title) +'</span>');
+}
+
+
 module.exports = {
   setFocusToDebuggerEditor: setFocusToDebuggerEditor,
   getFunctionId: getFunctionId,
   getProcedureId: getProcedureId,
+  setDebuggerTitle: setDebuggerTitle,
 };
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 058e21a..ae940b0 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2118,10 +2118,20 @@ define('tools.querytool', [
       queryToolActions.executeMacro(this.handler, macroId);
     },
 
+    set_selected_option: function(selected_config) {
+      this.connection_list.forEach(option =>{
+        if(option['server'] == selected_config['server'] && option['database'] == selected_config['database']) {
+          selected_config['is_selected'] = true;
+        } else {
+          option['is_selected'] = false;
+        }
+      });
+    },
+
     on_change_connection: function(connection_details, ref) {
-      let title = this.$el.find('.editor-title').html();
-      if(connection_details['title'] != title) {
+      if(!connection_details['is_selected']) {
         var self = this;
+        self.set_selected_option(connection_details);
         var loadingDiv = null;
         var msgDiv = null;
         if(ref){
@@ -2174,6 +2184,7 @@ define('tools.querytool', [
                   'is_allow_new_connection': true,
                   'database_name': connection_details['database_name'],
                   'server_name': connection_details['server_name'],
+                  'is_selected': true,
                 };
                 self.connection_list.unshift(connection_data);
                 self.render_connection(self.connection_list);
@@ -2518,6 +2529,14 @@ define('tools.querytool', [
           });
 
           $('#btn-conn-status i').removeClass('obtaining-conn');
+
+          var tree_data = pgWindow.default.pgAdmin.Browser.treeMenu.translateTreeNodeIdFromACITree(pgWindow.default.pgAdmin.Browser.treeMenu.selected());
+
+          var server_data = pgWindow.default.pgAdmin.Browser.treeMenu.findNode(tree_data.slice(0,2));
+          var database_data = pgWindow.default.pgAdmin.Browser.treeMenu.findNode(tree_data.slice(0,4));
+
+
+
           self.gridView.set_editor_title(_.unescape(url_params.title));
           let connection_data = {
             'server_group': self.gridView.handler.url_params.sgid,
@@ -2527,8 +2546,9 @@ define('tools.querytool', [
             'role': null,
             'title': _.unescape(url_params.title),
             'is_allow_new_connection': false,
-            'database_name': _.unescape(url_params.title.split('/')[0]),
-            'server_name': _.unescape(url_params.title.split('@')[1]),
+            'database_name': _.unescape(database_data.data.label),
+            'server_name': _.unescape(server_data.data.label),
+            'is_selected': true,
           };
           self.gridView.connection_list.unshift(connection_data);
           self.gridView.render_connection(self.gridView.connection_list);
@@ -3861,7 +3881,7 @@ define('tools.querytool', [
         if (arguments.length > 0 && arguments[arguments.length - 1] == 'connect') {
           reconnect = true;
         }
-        newConnectionHandler.dialog(self, reconnect);
+        newConnectionHandler.dialog(self, reconnect, self.preferences);
       },
       // This function will include the filter by selection.
       _include_filter: function() {
diff --git a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
index 1f2fa6c..f2614db 100644
--- a/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
+++ b/web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
@@ -300,6 +300,29 @@ def register_query_tool_preferences(self):
                          'transaction status.')
     )
 
+    self.qt_tab_title = self.preference.register(
+        'display', 'qt_tab_title_placeholder',
+        gettext("Query tool tab title placeholder"),
+        'text', '%DATABASE%/%USERNAME%@%SERVER%',
+        category_label=PREF_LABEL_DISPLAY,
+        help_str=gettext(
+            'Supported placeholders: DATABASE, USERNAME and SERVER. '
+            'You can also provide any string with or without placeholders.'
+        )
+    )
+
+    self.ve_edt_tab_title = self.preference.register(
+        'display', 'vw_edt_tab_title_placeholder',
+        gettext("View/Edit tab title placeholder"),
+        'text', '%SCHEMA%.%TABLE%/%DATABASE%/%USERNAME%@%SERVER%',
+        category_label=PREF_LABEL_DISPLAY,
+        help_str=gettext(
+            'Supported placeholders: SCHEMA, TABLE, DATABASE, USERNAME and '
+            'SERVER. You can also provide any string with or '
+            'without placeholders.'
+        )
+    )
+
     self.connection_status = self.preference.register(
         'display', 'connection_status_fetch_time',
         gettext("Connection status refresh rate"), 'integer', 2,
