azureazure-data-studio

Azure Data Studio does not provide any way to connect re-opened query window to database


I closed Azure Data Studio (ADS) with a blank query tab open. When I restarted the app the blank query tab opened with it. I wrote a query in the tab then realised there appears to be no way to set the connection. Is there a way to connect this tab to a database?

The previously unsaved query tab reopens without a hotbar at the top of the window (the hotbar being the menu with Run, Connect, etc buttons):

enter image description here

Right-clicking on the tab doesn't offer any way to connect that I can see:

enter image description here

In contrast, tabs that were previously saved before closing ADS reopen showing the hotbar:

enter image description here

And tabs opened since ADS was restarted, which are still unsaved, also show the hotbar:

enter image description here

So it's only unsaved tabs present when ADS restarts that don't show the hotbar.

Am I missing something? Is there a way to connect this unsaved tab to a database? Or is the only option to open another query tab and copy the query I wrote to the new tab?


Solution

  • The only way I managed to get the Connect and other controls to display at the top of the old window was to save it as a .sql file. Once saved the appropriate controls became visible at the top of the window.

    I guess that Azure Data Studio must use the file extension of a window to determine if it's a SQL window or not, at least when it opens an old, unsaved, window from the previous session.

    When reopened the window retained the previous title it had before it was closed: "SQLQuery_1", without a file extension. When the window was created in the previous session Azure Data Studio had recognised it as a SQL window, and had displayed the Connect and other controls at the top. But when it was reopened after Azure Data Studio restarted it looks like Azure Data Studio no longer recognised it as a SQL window, presumably because it had no file extension.