java用windows身份验证连接sqlsever2005

来源:百度知道 编辑:UC知道 时间:2024/05/24 13:00:38
不要用户名密码连接
Login failed for user ''. The user is not associated with a trusted SQL Server connection.

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databasename=news");
databasename=你自己的数据库名字

不填用户名和密码就是了