Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public void connect()
  2. {
  3. long start = System.currentTimeMillis();
  4. try {
  5. Class.forName("com.mysql.jdbc.Driver");
  6. conn = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + name, user, pass);
  7. plugin.getLogger().info("Nawiazano polaczenie z serwerem MySQL!");
  8. plugin.getLogger().info("Polaczenie trwalo " + (System.currentTimeMillis() - start) + "ms!");
  9. } catch (ClassNotFoundException e) {
  10. plugin.getLogger().warning("Nie znaleziono sterownika JDBC!");
  11. plugin.getLogger().warning("Blad: " + e.getMessage());
  12. e.printStackTrace();
  13. } catch (SQLException e2) {
  14. plugin.getLogger().warning("Nie mozna nawiazac polaczenia z serwerem MySQL!");
  15. plugin.getLogger().warning("Blad: " + e2.getMessage());
  16. e2.printStackTrace();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement