I started working today with the JDBC Microsoft SQL Server driver and I am always getting the error that no suitable driver has been found.
Here is my 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();
}
I also used Class.forName(...), but since it will be running on other people's servers I don't want to use this option (This option also did not work). Help would be appreciated, have a nice weekend