Controlla se Class#forName()
sul driver JDBC non genera ClassNotFoundException
.
try {
Class.forName(driverClassName);
// Success.
}
catch (ClassNotFoundException e) {
// Fail.
}
Controlla se DriverManager#getConnection()
o DataSource#getConnection()
non genera SQLException
.
try (Connection connection = DriverManager.getConnection(url, username, password)) {
// Success.
}
catch (SQLException e) {
// Fail.
}