1, first is if you encounter javax.servlet.ServletException:java.lang.ClassNotFoundException: Com.microsoft.jdbc.sqlserver.SQLServerDriver this error,
Then presumably you should put Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver");
Changed into Class.forName ("Com.microsoft.sqlserver.jdbc.SQLServerDriver");
2, when the error for the Javax.servlet.ServletException:java.sql.SQLException:No suitable driver found for jdbc:microsoft:sqlserver:// When Localhost:1034;databasename=test2,
String url= should be "jdbc:microsoft:sqlserver://localhost:1034;databasename=test2";
Changed to String url= "Jdbc:sqlserver://localhost:1034;databasename=test2";
3, error is javax.servlet.ServletException:com.microsoft.sqlserver.jdbc.SQLServerException: Unable to open login requested database "Test2". Login failed.
There are many solutions to this problem online, such as checking drivers, user rights, and so on, I repeatedly to create users, set permissions, has not been successful. Finally I was in the Configuration Manager, check the network configuration of TCP/IP ipall dynamic port, found that he is not the usual 1433, but 1034, and then changed in the code, just fine ... In addition, the user rights in SQL Server should be noted, otherwise it is easy to problem