java.sql.SQLException: Single-Sign-On is only supported on Windows. Please specify a user name

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 06:59:35

问题


I am using the jTDS driver in order to connect to an SQL Server database from my Android application, which uses the Windows Authentication. As advised in the FAQs, I read the READMESSO file and as told, I placed the native SPPI library (ntlmauth.dll) in the system path (defined by the PATH system variable)

However, when I try to connect to the database using the following code:

String driver = "net.sourceforge.jtds.jdbc.Driver";
Class.forName(driver).newInstance();
String connString = "jdbc:jtds:sqlserver://192.168.56.1/MyMovies;";
Conncection conn = DriverManager.getConnection(connString);

I get the following exception:

java.sql.SQLException: Single-Sign-On is only supported on Windows. Please specify a user name.

回答1:


Since you are connecting from an android device, you would not be able to get the SSO credentials required by the driver to connect to SQL server. The setting you referred to works only if the java program trying to connect to the DB is on a windows machine, which is clearly mentioned by the error message.

Unless your application has authorization based on the SSO user connecting to the DB, you should have an SQL Server user-based authentication mechanism to connect to the server and all authorization procedures should be tied to this user.




回答2:


You might have to give the username also.

"jdbc:jtds:sqlserver://192.168.56.1/MyMovies;instance=SQLEXPRESS;user=foo"



来源:https://stackoverflow.com/questions/12375437/java-sql-sqlexception-single-sign-on-is-only-supported-on-windows-please-speci

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!