views:

665

answers:

2

i wrote the code like this to connect sqlserver database.i load the driverclass,but iam not getting connection. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); System.out.println("class Loaded");
connection = DriverManager.getConnection("jdbc:sqlserver://10.171.160.114:2001","XXXXXX","XXXXXX");
System.out.println("connected");

iam getting this error " The user is not associated with a trusted SQL Server connection. ".please advice me on this.any help greately appreciated.

A: 

It probably has to do with the authentication mechanism you use. See this question for details.

For more information, read here.

kgiannakakis
+4  A: 

The SQL server has been configured to operate in "Windows Authentication Mode (Windows Authentication)" and doesn't allow the use of SQL accounts. Right click on your SQL Server node in Management Studio and choose Properties. On the dialog that appears go to security tab and make sure that "SQL Server and Windows Authentication mode" is selected

Paragon