Windows Authentication for SQL Server using JBDC on a Mac

后端 未结 6 894
小蘑菇
小蘑菇 2021-02-01 07:21

Is it possible to connect to SQL Server using Windows authentication/integrated security from a Mac? I am using the type 4 JDBC driver provided by Microsoft. The front end (a fo

6条回答
  •  温柔的废话
    2021-02-01 07:42

    jTDS is inferior to Microsoft's JDBC driver (in particular, it cannot figure out the types of parameters in a prepared statement)

    Yes, you can authenticate to MS SQL Server using Active Directory authentication, as Active Directory is just Kerberos + LDAP, which are open source and implemented on Mac

    Kerberos config /etc/krb5.conf :

    [libdefaults]
    default_realm = YOUR_REALM.NET
    
    [realms]
    YOUR_REALM.NET = {
        kdc = host.your-domain.net
    }
    

    I needed to use the fully qualified domain name of the KDC, not just the domain name

    JDBC Connection String:

    jdbc:sqlserver://$host;database=$db;integratedSecurity=true;authenticationScheme=JavaKerberos
    

    If $host does not have an SPN of MSSQLSrv/$host, add serverSp=$SPN to the JDBC connection string

提交回复
热议问题