1

I am having trouble accessing my SQL Server database using Kerberos with a JDBC connection. Note I'm running Linux with Spark version 2.2.0.

I am not specifying anything related to kerberos tickets in my spark_connect, as I've heard rstudio server pro may have an overlapping capability, though I am not sure if it applies to this.

My connection looks like:

table <- sparklyr::spark_read_jdbc(
  sc, 
  "AMI_DATA_STAG_RES", 
  options = c(list(
    url = paste0("jdbc:sqlserver://", <MY SERVER>), 
    databaseName = "fun_db", 
    dbtable = "fun_tbl", 
    driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver",
    integratedSecurity = "true",
    authenticationScheme = "JavaKerberos"))
  )

The error I get is:

Error: com.microsoft.sqlserver.jdbc.SQLServerException: 
    Kerberos Login failed: Integrated authentication failed.
    ClientConnectionId:878fa848-91cb-4d78-bd48-6dad88b1e401 
      due to javax.security.auth.login.LoginException 
        (Cannot get any of properties: [user, USER] from con properties not available to garner  authentication information  from the user)

I've read solutions on the internet, but I'm not sure what applies to windows and what will work with my Rstudio Server set-up on Redhat.

Any help appreciated. I'm pretty new to the wonderful world of Kerberos.

EDIT: I've updated my spellings (thanks!) and pasted in the new error. If I add into the connection string my username and password then I think it does work, but I want to avoid having to paste in my password.

Adding in just my username yields the error:

Error: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot login with Kerberos principal dzafar, check your credentials. Kerberos Login failed: Integrated authentication failed. ClientConnectionId:543c9b44-e1e0-4fe8-8510-235a21be2845 due to javax.security.auth.login.LoginException (Cannot get any of properties: [password, PASSWORD] from con properties not available to garner  authentication information from the user)
Zafar
  • 1,897
  • 15
  • 33
  • You have two typos in the property `authenticationSchema`. The correct property is `authenticationScheme` (ends in e, not a) and the value should be `JavaKerberos` (that is `Ke**r**beros`). See https://learn.microsoft.com/en-us/sql/connect/jdbc/using-kerberos-integrated-authentication-to-connect-to-sql-server?view=sql-server-2017 for more information – Mark Rotteveel Jul 20 '18 at 16:28
  • thanks @MarkRotteveel! I've updated my question with the new error that comes out. I think I need to add the kerberos ticket to my spark context somehow? – Zafar Jul 20 '18 at 18:49

0 Answers0