We often get a lot of questions from our customers about best practices when connecting to a database. In this video we are going to cover the most relevant.
In this video you could find out some interesting topics about, for example:
Open / Close the connection as fast as possible.
Avoid idle connections.
Connection may fail, so, retry Logic is key in Azure SQL.
Try .. Catch for all connections and command executions.
Keep your connectivity drivers updated.
Service Database Tier:
If you are using Single database
Serverless / Autoclose (Azure): Use a robust connection retry logic in the resume process.
If you are using Elastic Database pool (Azure)
All databases are running on the same SQL Server Instance.
So, your database might be impacted about other workload databases.
Contained User instead of Logins.
Redirect connection policy.
Use TCP:servername and port 1433.
Use application_name parameter in the connection string to identify your application.
Self-Help tool to identify the connectivity issue:
In the following two links you could find some Powershell scripts that could help you to identify possible connectivity issues, the first link will help you to identify connection and execution latency and the second one will help you to identify possible connectivity issue checking, for example, DNS resolution, taking network traces, etc..