How do I connect to MS Sql database using Java.
I am using the jtds jdbc driver but keep getting the "No Suitable Driver" error. I have checked the jdbc URL and it conforms to the URL format specified in the documentation.
I am running on JRE6.
Have you actually loaded the driver class?
Example for MySQL:
Class.forName("com.mysql.jdbc.Driver");
before connecting:
Connection con = DriverManager.getConnection(url,"user", "pw");
I have actually found a solution. One can use the microsoft SQL server jdbc driver
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url = " jdbc:microsoft:sqlserver://serverjag:1433";
Connection conn = DriverManager.getConnection(url,"sa","");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.