How to disconnect servers after N minutes? (Set server connection timeout.)

Chuck Roberts 65 Reputation points
2023-10-10T09:36:56.7033333+00:00

I have Azure Data Studio Desktop App Version 1.45.1 (Oct 2023) on Windows 11.

I am doing tutorials to learn ADS, so I'm a beginner here. I put my computer to sleep and left ADS running. I had 2 servers connected. This morning they were still connected.

How do I set the to disconnect after N minutes of inactivity?

I already search settings for "timeout" and "disconnect" and I have not found anything yet. On the server, Advanced settings, the "Connect timeout" is already 30 (seconds) but that only applies when trying to connect to a server.

Thank you.

p.s. I do have access to the online Azure Data Factory. Maybe I have to set something there?

Yep, in online Azure Data Factory my "twotrees" database has an auto-pause delay of 5 hours but this did not disconnect the server in ADS. In ADS the server was still shown with a green circle which means it is connected.

Azure Data Studio
Azure Data Studio
A cross-platform database tool for data professionals using on-premises and cloud data platforms on Windows, macOS, and Linux.
106 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vinodh247 12,741 Reputation points
    2023-10-10T10:17:59.79+00:00

    Hi Chuck Roberts:

    Thanks for reaching out to Microsoft Q&A.

    If you have set the connect timeout properties but still doesn't work you can try turning on the AUTO_CLOSE feature. It flushes the procedure cache after each connection which makes sure you have the connections to your database is not open. But please note that this option is

    1. Only at the database level. which means you have to set it for all the databases which you want the conn to be closed.
    2. Might severely degrade performance of your database where there is heavy load as it adds overhead to your database for completing this step.

    Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.


1 additional answer

Sort by: Most helpful
  1. Olaf Helper 42,761 Reputation points
    2023-10-10T10:04:14.4+00:00

    I put my computer to sleep ... This morning they were still connected.

    When you set a computer to sleep mod, all network connection will also shut down and everything gets disconnected; so why to you think ADS is against everything else still connected?

    If you re-run a query then ADS will re-connect, that's all.

    1 person found this answer helpful.