I am totally new to MS SQL and I am stuck on some errors.
I included the sqljdbc42.jar as an external file in eclipse and I have the following lines of code:
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
String url = "jdbc:sqlserver://" + HOST + ":" + PORT + ";databaseName=" + DATABASE;
try {
connection = DriverManager.getConnection(url, USERNAME, PASSWORD);
} catch (SQLException e) {
System.err.println("[SQL] Error in connection: " + url);
e.printStackTrace();
}
Whenever i run this code, I encounter the following errors:
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
and
java.sql.SQLException: No suitable driver found for jdbc:sqlserver://sql3.freemysqlhosting.net:3306;databaseName=sql3109409
I set the eclipse export settings to export generated files and also external resources. Could anyone please help me fix this error?
Hava a nice weekend, Lucas Romier