0

I'm trying to connect my Databricks cluster to an existing SQL Server database using python. I will like to leverage the integrated authentication method. Getting error com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.

jdbcHostname = "sampledb-dev.database.windows.net"
jdbcPort= 1433
jdbcDatabase = "sampledb-dev"
jdbcUrl = "jdbc:sqlserver://{0}:{1}; database={2}".format(jdbcHostname, jdbcPort, jdbcDatabase)

connectionProperties={
  "integratedSecurity" : "true",
  "driver" : "com.microsoft.sqlserver.jdbc.SQLServerDriver"
}

print(jdbcUrl)
query ="(SELECT * FROM TABLE1.Domain)"

domains = spark.read.jdbc(url = jdbcUrl, table = query, properties = connectionProperties)
display(domains) 
jgtrz
  • 365
  • 6
  • 19

1 Answers1

0

You can't use integratedSecurity=true with an Azure PaaS database. IntegratedSecurity is an on-premise construct.

You need to use authentication=ActiveDirectoryIntegrated or authentication=ActiveDirectoryPassword, please see JDBC docs here: https://learn.microsoft.com/en-us/sql/connect/jdbc/connecting-using-azure-active-directory-authentication?view=sql-server-ver15

You will also need your account to be user with appropriate permissions to that database which is synch'd to Azure AD. If you use multi-factor authentication, then that's not supported for JDBC and your admin will need to provide you with a non-MFA enabled account. You'll know if this is the case because you will get a WSTrust error when trying to connect.

TJB
  • 787
  • 1
  • 8
  • 29
  • For the ActiveDirectoryIntegrated method, it looks like it's only supported on Windows. I got the below error when chose this method for authentication. com.microsoft.sqlserver.jdbc.SQLServerException: ActiveDirectoryIntegrated is only supported on Windows operating systems. – hui chen Aug 31 '20 at 09:59
  • Yes that makes sense. You're stuck with AD Password, AD interactive or Sql auth if not using a Windows OS. – TJB Sep 01 '20 at 10:09