SQL Database application development overview
This article walks through the basic considerations that a developer should be aware of when writing code to connect to Azure SQL Database.
For a tutorial showing you how to create a server, create a server-based firewall, view server properties, connect using SQL Server Management Studio, query the master database, create a sample database and a blank database, query database properties, connect using SQL Server Management Studio, and query the sample database, see Get Started Tutorial.
Language and platform
There are code samples available for various programming languages and platforms. You can find links to the code samples at:
- More information: Connection libraries for SQL Database and SQL Server.
You can leverage open source tools like cheetah, sql-cli, VS Code. Additionally, Azure SQL Database works with Microsoft tools like Visual Studio and SQL Server Management Studio. You can also use the Azure Management Portal, PowerShell, and REST APIs help you gain additional productivity.
Azure SQL Database manages the resources available to a database using two different mechanisms: Resources Governance and Enforcement of Limits.
- More information: Azure SQL Database resource limits.
Azure SQL Database provides resources for limiting access, protecting data, and monitoring activities on a SQL Database.
- More information: Securing your SQL Database.
- Azure SQL Database supports both SQL Server authentication users and logins, as well as Azure Active Directory authentication users and logins.
- You need to specify a particular database, instead of defaulting to the master database.
- You cannot use the Transact-SQL USE myDatabaseName; statement on SQL Database to switch to another database.
- More information: SQL Database security: Manage database access and login security.
When a transient error occurs while connecting to SQL Database, your code should retry the call. We recommend that retry logic use backoff logic, so that it does not overwhelm the SQL Database with multiple clients retrying simultaneously.
- Code samples: For code samples that illustrate retry logic, see samples for the language of your choice at: Connection libraries for SQL Database and SQL Server.
- More information: Error messages for SQL Database client programs.
- In your client connection logic, override the default timeout to be 30 seconds. The default of 15 seconds is too short for connections that depend on the internet.
- If you are using a connection pool, be sure to close the connection the instant your program is not actively using it, and is not preparing to reuse it.
- On the computer that hosts your client program, ensure the firewall allows outgoing TCP communication on port 1433. More information: Configure an Azure SQL Database firewall.
- If your client program connects to SQL Database while your client runs on an Azure virtual machine (VM), you must open certain port ranges on the VM. More information: Ports beyond 1433 for ADO.NET 4.5 and SQL Database.
- Client connections to Azure SQL Database sometimes bypass the proxy and interact directly with the database. Ports other than 1433 become important. For more information, Azure SQL Database connectivity architecture and Ports beyond 1433 for ADO.NET 4.5 and SQL Database.
Data sharding with elastic scale
Elastic scale simplifies the process of scaling out (and in).
- Design Patterns for Multi-tenant SaaS Applications with Azure SQL Database.
- Data dependent routing.
- Get Started with Azure SQL Database Elastic Scale Preview.
Explore all the capabilities of SQL Database.