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
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.
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.
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.
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.
See jTDS FAQ http://jtds.sourceforge.net/faq.html
you will have to pass useNTLMv2=true
and domain=yourdomain
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With