Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sql Server - connect with windows authentication

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 JTDS driver

dbUrl=jdbc:jtds:sqlserver://192.168.3.6:1099/db_test;instance=test Connection con = DriverManager.getConnection( dbUrl, "", "" ); 

I have username and password of administrator user of sql server !

I also put ntlmauth.dll into c:\windows and c:\windows\system32 and I have always error:

java.sql.SQLException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Any idea to solve my problem ? Thank you very much

like image 609
Federico Artebani Avatar asked Sep 10 '10 07:09

Federico Artebani


People also ask

Can a SQL Server login use Windows Authentication?

There are two possible modes: Windows Authentication mode and mixed mode. Windows Authentication mode enables Windows Authentication and disables SQL Server Authentication. Mixed mode enables both Windows Authentication and SQL Server Authentication. Windows Authentication is always available and cannot be disabled.

How does Windows Authentication work in SQL Server?

Windows authentication uses a series of encrypted messages to authenticate users in SQL Server. When SQL Server logins are used, SQL Server login names and encrypted passwords are passed across the network, which makes them less secure.

How do I connect to SQL Server using Windows Authentication in PowerShell?

By default, the SQL Server PowerShell components use Windows Authentication when connecting to an instance of the Database Engine. You can use SQL Server Authentication by either defining a PowerShell virtual drive, or by specifying the -Username and -Password parameters for Invoke-Sqlcmd.

How do I connect to SQL Server using Windows Authentication in Linux?

SSMS on a domain-joined Windows client Sign in to a domain-joined Windows client using your domain credentials. Make sure SQL Server Management Studio is installed, then connect to your SQL Server instance (for example, mssql-host.contoso.com ) by specifying Windows Authentication in the Connect to Server dialog.


1 Answers

See jTDS FAQ http://jtds.sourceforge.net/faq.html

you will have to pass useNTLMv2=true and domain=yourdomain

like image 61
ajay_whiz Avatar answered Sep 17 '22 09:09

ajay_whiz