Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Connect(){
- try
- {
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- String url = "jdbc:mysql://" + host + ":" + port + "/"+ db;
- ct = DriverManager.getConnection(url, user, pass);
- st = ct.createStatement();
- System.out.println("Csatlakozva....n");
- }
- catch (InstantiationException e)
- {
- Main.textArea.setText("Error : Instantiation!");
- //System.err.println("Error : Instantiation");
- e.printStackTrace();
- } catch (IllegalAccessException e)
- {
- Main.textArea.setText("Error : Illegális Behatolás!");
- //System.err.println("Error : Illegális Behatolás!");
- e.printStackTrace();
- } catch (ClassNotFoundException e)
- {
- Main.textArea.setText("Error : Class Nem Található!");
- //System.err.println("Error : Class Nem Található!");
- e.printStackTrace();
- } catch (SQLException e)
- {
- Main.textArea.setText("Error : Adatbázis Nem Található!");
- //System.err.println("Error : Adatbázis Nem Található!");
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement