Azure SQL Database libraries for Java


Azure SQL Database is a relational database service using the Microsoft SQL Server engine that supports table, JSON, spatial, and XML data.

To get started with Azure SQL Database, see Azure SQL Database: Use Java to connect and query data.

Client JDBC driver

Connect to Azure SQL Database from your applications using the SQL Database JDBC driver. You can use the Java JDBC API to directly connect with the database or use data access frameworks that interact with the database through JDBC such as Hibernate.

Add a dependency to your Maven pom.xml file to use the client JDBC driver in your project.



Connect to SQL database and select all records in a table using JDBC.

String connectionString = "jdbc:sqlserver://;database=fiber;user=raisa;password=testpass;encrypt=true;hostNameInCertificate=*;loginTimeout=30;";
try {
    Connection conn = DriverManager.getConnection(connectionString);
    Statement statement = conn.createStatement();
    ResultSet resultSet = statement.executeQuery("SELECT * FROM SALES");

Management API

Create and manage Azure SQL Database resources in your subscription with the management API.

Add a dependency to your Maven pom.xml file to use the management API in your project.



Create a SQL Database resource and restrict access to a range of IP addresses using a firewall rule.

SqlServer sqlServer = azure.sqlServers().define(sqlDbName)
                    .withNewFirewallRule("", "")


Configure Azure SQL Database with the management API
Deploy WordPress powered by SQL Database
Scale SQL Database across multiple Azure regions
Manage shared SQL database workloads with elastic pools

Explore more sample Java code for Azure SQL Database you can use in your apps.