我在Windows身份驗證模式下使用默認實例的MS SQL設置。 我有kerberos作爲MSSQlSvc ServerSpn實施。使用Kerberos身份驗證和ServerSpn的Microsoft JDBC驅動程序URL
我想在Windows操作系統上從我的Java客戶端遠程訪問SQL Server。
Java客戶端與以下JVM Paramters執行:貌似
-Djava.security.auth.login.config=path_to_file/client.conf -Djava.security.krb5.conf=path_to_file/krb5.ini
的URL我使用如下:
jdbc:sqlserver://MSSQLSvc/FQDN_OF_SQL_Server:PORT;integratedSecurity=true;authenticationScheme=JavaKerberos
我收到以下錯誤:
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host MSSQLSvc/FQDN_OF_SQL_Server, port 1433 has failed. Error: "null. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.". at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191) at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:242) at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2293) at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:506) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1523) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1204) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1040) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:554) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1019) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at microsoftJdbcDriver.getConnection(microsoftJdbcDriver.java:32) at microsoftJdbcDriver.displayDbProperties(microsoftJdbcDriver.java:51) at microsoftJdbcDriver.main(microsoftJdbcDriver.java:93)
client.conf文件:
SQLJDBCDriver {
com.sun.security.auth.module.Krb5LoginModule required
useTicketCache=true
doNotPrompt=true
};
的Kb5.ini:
[libdefaults]
default_realm = MYDOMAIN.COM
clockskew = 300
[realms]
MYDOMAIN.COM = {
kdc = MYDOMAIN.COM
admin_server = MYDOMAIN.COM
}
[domain_realm]
.domain.com = MYDOMAIN.COM
domain.com> = <MYDOMAIN.COM
[appdefaults]
autologin = true
forward = true
forwardable = true
encrypt = true'
還要注意:
- 防火牆是不是一個問題,同樣的事情與當地 驗證效果很好。使用sql_auth.dll
- 的SQL Management Studio中可以 也訪問實例
既然你是在Windows上,爲什麼不使用SSPI實現與DLL。它應該更容易。 –
我正在尋找一種解決方案,它也可以作爲非windows的客戶端。幾乎沒有修改。迭代。窗口到Windows - 本地身份驗證的作品,現在嘗試Kerberos窗口到Windows,然後Linux到Windows。 –