Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public boolean connect() {
- final Timming t = new Timming("MySQL ping").start();
- try {
- Class.forName("com.mysql.jdbc.Driver");
- Logger.info("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.name, this.user, this.pass);
- this.conn = DriverManager.getConnection("jdbc:mysql://" + this.host + ":" + this.port + "/" + this.name, this.user, this.pass + "?autoReconnect=true");
- Logger.info("Connected to the MySQL server!", "Connection ping " + t.stop().getExecutingTime() + "ms!");
- return true;
- }
- catch (ClassNotFoundException e) {
- Logger.warning("JDBC driver not found!", "Error: " + e.getMessage());
- e.printStackTrace();
- }
- catch (SQLException e2) {
- Logger.warning("Can not connect to a MySQL server!", "Error: " + e2.getMessage());
- e2.printStackTrace();
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement