Sql Server - connect with windows authentication

后端 未结 2 1147
深忆病人
深忆病人 2020-11-30 04:14

i must connect to a sql server with windows authentication

sql server is on machine 192.168.3.6 web server (client) is on my machine 192.168.3.10

I\'m using

2条回答
  •  执笔经年
    2020-11-30 04:30

    What you can do is something like:

    String url = "jdbc:jtds:sqlserver://MYPC/MYDB;instance=SQLEXPRESS";
    Class.forName("net.sourceforge.jtds.jdbc.Driver");
    Connection conn = DriverManager.getConnection(url);
    

    Make sure you have jtds.jar in the Java build path.

    Also, add "-Djava.library.path="PATH\JTDS\x64\SSO" where 'Path' is where your SSO folder is after installing the JTDS driver (this is where you have your ntlmauth.dll).

    Here is a short step-by-step guide showing how to connect to SQL Server using jTDS (as well as JDBC) with Windows authentication should you need more details. Hope it helps!

提交回复
热议问题