jdbc.SQLServerException: Login failed for user for any user

后端 未结 4 846
你的背包
你的背包 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:23

    Since you get this error,the Sql server correctly listens to the port.

    1. Open Sql Server Management Studio connect to your Server.
    2. right click on the server's icon and choose properties.
    3. Go to the security tab and tick Sql Server and Windows Authentication mode.

    If you want to define a user,go from the tree, to Security->Logins,right click on logins folder and click "New Login".

    Now your server should work with this Url String. Use the log file of the Server that may help you understand its working.

提交回复
热议问题