SoFunction
Updated on 2025-03-08

jsp connection SQL server 2008 solution to not be connected

1. First of all, if you encounter: : This error,

Then you probably should ("");

Change to ("");

2. When the error is: : No suitable driver found for jdbc:microsoft:sqlserver://localhost:1034;DatabaseName=test2 ,

String url="jdbc:microsoft:sqlserver://localhost:1034;DatabaseName=test2";

Change to String url="jdbc:sqlserver://localhost:1034;DatabaseName=test2";

3. Error is:: Unable to open the requested database "test2" for logging in. Login failed.

There are many solutions to this problem online, such as checking drivers, user permissions, etc. I repeatedly create users and set permissions, but I have not succeeded. . Finally, I went to the configuration manager and checked the dynamic port of the IPALL of TCP/IP in the network configuration. I found that it was not the usual 1433, but 1034, and then changed it in the code, and it was fine. . . In addition, you should pay attention to the user permissions in SQL Server, otherwise problems will be prone to problems.