jdbc.SQLServerException: Login failed for user for any user

后端 未结 4 845
你的背包
你的背包 2021-01-04 23:55

I trying to test the connection with my local sql DB. I have this code:

try{
    Class.forName(\"com.microsoft.sqlserver.jdbc.SQLServerDriver\").newInstance(         


        
4条回答
  •  长情又很酷
    2021-01-05 00:19

    If you try to connect with database which is using windows authentication, you can use 'integratedSecurity' option in your connection string.

    DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=SocialFamilyTree;integratedSecurity=true;");
    

提交回复
热议问题