Connecting to SQL Databases using JDBCΒΆ

You can use Azure Databricks to query Microsoft SQLServer and Azure SQL Database tables using the JDBC driver that comes preloaded with Databricks Runtime versions 3.4 and above.

To confirm that the JDBC driver class is available in the cluster, you can use the following notebook cell. SQLServer and Azure SQL Database both user the same driver.

// Testing for the JDBC Driver Class

// Define the credentials and parameters
val (user, passwd) = get_sqlserver_creds
val hostname = ""
val dbName = "mydb"
val jdbcPort = 1433

val jdbcUrl = (s"jdbc:sqlserver://${hostname}:${jdbcPort};database=${dbName};user=${user};password=${passwd}")

val driverClass = ""
val connectionProperties = new java.util.Properties()