I have found some similar questions but with no helpful answers. I need to manipulate an MS SQL Server database named PDPJ_Student from my java application and i cannot connect to it. I get the following error:
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Login failed for user 'LAPTOP-TITI/Titi'. The user is not associated with a trusted SQL Server connection.
and my source looks like this:
Connection con = null;
try{
Class.forName("com.microsoft.j开发者_如何转开发dbc.sqlserver.SQLServerDriver").newInstance();
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://LAPTOP-TITI;DatabaseName=PDPJ_Student", "LAPTOP-TITI/Titi", "");
}
catch(Exception e){
System.out.println("Error at connection");
e.printStackTrace();
}
When i start MS SQL Server, at authenticatin, the SERVER NAME says: LAPTOP-TITI; and the Authentication is set to Windows Authentication. The user name field says LAPTOP-TITI/Titi but it is disabled, as well as the Password field, which is empty.
I have also tried:
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://LAPTOP-TITI;DatabaseName=PDPJ_Student", integratedSecurity=true);
but still nothing ..
What am I doing wrong ? Can you give me some indications please?
p.s I am not allowed to change my Authentication type, and even if I try changing to SQL Server Authentication, it doesn`t let me create any new users
Your question doesn't mention whether your client machine is running Windows or non-windows. This topic on MSDN suggests that if your client is using Linux, you'll need to purchase the DataDirect driver to get Kerberos authentication working. If you're on Windows, it should be possible with Microsoft's JDBC driver.
精彩评论