December 2019
Intermediate to advanced
494 pages
11h 41m
English
Let's make a connection and print our data using JDBC. Create a new Gradle project using Eclipse. Gradle simplifies dependency management for our examples. In this case, it will manage the Microsoft JDBC Driver for SQL. Update the build.gradle file, as shown here:
apply plugin: 'java-library' repositories { jcenter() } dependencies { runtime 'com.microsoft.sqlserver:mssql-jdbc:7.0.0.jre8' }
Now, create a public class called AzureSqlConsoleApp, as shown here:
package com.packtpub.azure // [...] public class AzureSqlConsoleApp { public static void main(String args[]) { // [...] String url = String.format("jdbc:sqlserver://%s:1433;database=%s;user=%s;password=%s;encrypt=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;", ...