Solution to the problem that JSP can’t connect to SQL Server 2008


1. First of all, if you encounter javax.servlet.ServletException : java.lang.ClassNotFoundException : . sqlserver.SQLServerDriver This is a mistake,

So you should Class.forName (” . sqlserver.SQLServerDriver “);

Change to Class.forName (” . jdbc.SQLServerDriver “);

2. When the error is javax.servlet.ServletException : java.sql.SQLException : No suitable driver found for jdbc:microsoft : sqlserver://localhost : 1034; databasename = test2 >,

The string URL should be=“ jdbc:microsoft : sqlserver://localhost :1034;DatabaseName=test2″;

Change to string URL=“ jdbc:sqlserver :// localhost:1034;DatabaseName=test2 “;

3. Error is javax.servlet.ServletException : . jdbc.SQLServerException : unable to open database ‘test2’ requested by login. Login failed.

There are many ways to solve this problem on the Internet, such as checking the driver, user permissions and so on. I repeatedly create users and set permissions, which has not been successful.. Finally, I went to the configuration manager to check the dynamic port of ipall of TCP / IP in the network configuration, and found that it is not the usual 1433, but 1034. Then I changed it in the code… In addition, you should pay attention to the user permissions in SQL server, otherwise it is easy to cause problems

Recommended Today

Introduce regular expressions in ruby in detail

A regular expression is a special sequence of characters that matches or finds other strings or collections of strings by using patterns with special syntax. grammar A regular expression is literally a pattern between slashes or any separator after% R, as follows: ? 1 2 3 4 5 6 7 8 9 10 11 12 […]