Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Connect to SQL Database by using Java with JDBC on Windows

[Java code sample] (sample_java.java) that you can use to connect to Azure SQL Database. The Java sample relies on the Java Development Kit (JDK) version 1.8. The sample connects to an Azure SQL Database by using the JDBC driver.

Requirements

Test environment

The Java code example in this topic assumes the following test table already exists in your Azure SQL Database database.

CREATE TABLE Person
(
	id         INT    PRIMARY KEY    IDENTITY(1,1),
	firstName  VARCHAR(32),
	lastName   VARCHAR(32),
	age        INT
);

Connection string for your SQL Database

The code sample creates a Connection object by using a connection string. You can find the connection string by using the Azure preview portal. For details about finding the connection string, see Create your first Azure SQL Database.