Solo verifica si Class#forName()
en el controlador JDBC no arroja ClassNotFoundException
.
try {
Class.forName(driverClassName);
// Success.
}
catch (ClassNotFoundException e) {
// Fail.
}
Solo verifica si DriverManager#getConnection()
o DataSource#getConnection()
no arroja SQLException
.
try (Connection connection = DriverManager.getConnection(url, username, password)) {
// Success.
}
catch (SQLException e) {
// Fail.
}