Controleer gewoon of Class#forName()
op de JDBC-driver gooit ClassNotFoundException
niet .
try {
Class.forName(driverClassName);
// Success.
}
catch (ClassNotFoundException e) {
// Fail.
}
Controleer gewoon of DriverManager#getConnection()
of DataSource#getConnection()
gooit SQLException
niet .
try (Connection connection = DriverManager.getConnection(url, username, password)) {
// Success.
}
catch (SQLException e) {
// Fail.
}