Advertisement
Guest User

Untitled

a guest
Jun 21st, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public static void Connect(){
  2. try
  3. {
  4. Class.forName("com.mysql.jdbc.Driver").newInstance();
  5. String url = "jdbc:mysql://" + host + ":" + port + "/"+ db;
  6. ct = DriverManager.getConnection(url, user, pass);
  7. st = ct.createStatement();
  8. System.out.println("Csatlakozva....n");
  9. }
  10.  
  11. catch (InstantiationException e)
  12.  
  13. {
  14. Main.textArea.setText("Error : Instantiation!");
  15. //System.err.println("Error : Instantiation");
  16. e.printStackTrace();
  17. } catch (IllegalAccessException e)
  18.  
  19. {
  20. Main.textArea.setText("Error : Illegális Behatolás!");
  21. //System.err.println("Error : Illegális Behatolás!");
  22. e.printStackTrace();
  23. } catch (ClassNotFoundException e)
  24.  
  25. {
  26. Main.textArea.setText("Error : Class Nem Található!");
  27. //System.err.println("Error : Class Nem Található!");
  28. e.printStackTrace();
  29. } catch (SQLException e)
  30.  
  31. {
  32. Main.textArea.setText("Error : Adatbázis Nem Található!");
  33. //System.err.println("Error : Adatbázis Nem Található!");
  34. e.printStackTrace();
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement