Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. private void init() {
  2. try {
  3. Driver driver = (Driver) Class.forName(driverName).newInstance();
  4. DriverManager.registerDriver(driver);
  5. } catch (SQLException | ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
  6. if (ex.getClass().equals(SQLException.class)) {
  7. LOGGER.warn(SQL_EXCEPTION + ex.getMessage());
  8. } else if (ex.getClass().equals(ClassNotFoundException.class)) {
  9. LOGGER.warn(CLASS_NOT_FOUND_EXCEPTION + ex.getMessage());
  10. } else if (ex.getClass().equals(InstantiationException.class)) {
  11. LOGGER.warn(INSTANTIATION_EXCEPTION + ex.getMessage());
  12. } else {
  13. LOGGER.warn(ILLEGAL_ACCESS_EXCEPTION + ex.getMessage());
  14. }
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement