windows authentication over the network from java to MS-SQL server

17 views
Skip to first unread message

pramod ingole

unread,
Jul 20, 2012, 9:04:52 AM7/20/12
to hyder...@googlegroups.com

Hi,
plz help me....
how to connect SQLServer using windows authentication over network in java. When we connected in local machine(sql server and application in same machine) that works fine. my java code is ----
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection("jdbc:sqlserver://sandesh-think:1433;databaseName=AdventureWorksLT;integratedSecurity=true");
Class.forName("net.sourceforge.jtds.jdbc.Driver");
con = DriverManager.getConnection("jdbc:jtds:sqlserver://sandesh-think:1433/AdventureWorksLT;domain=workgroup");
When we try to connect over network, we are getting the below error.
We had tried the following.
1.  Copied the ntlmauth.dll in the Windows32/system and C:\Program Files\Java\jdk1.6.0_18\bin folder of my machine.(for jtds-1.2.5.jar)
OR
2.  Copied the sqljdbc_auth.dll in the Windows32/system and C:\Program Files\Java\jdk1.6.0_18\bin folder of my machine.(for sqljdbc4.jar)3. my system is windows 7 Professional SP1

com.microsoft.sqlserver.jdbc.SQLServerException: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:246)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:83)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2532)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:1929)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:1917)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1061)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at test.Example.main(Example.java:79)
--
Pramod  Ingole

Reply all
Reply to author
Forward
0 new messages