try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://"+hostName.getText()+";" +
"databaseName="+dbName.getText()+";user="+userName.getText()+";password="+password.getText()+";";
Connection con = DriverManager.getConnection(connectionUrl);
if(con!=null){JOptionPane.showMessageDialog(this, "Connection Established");}
} catch (SQLException e) {
JOptionPane.showMessageDialog(this, e);
//System.out.println("SQL Exception: "+ e.toString());
} catch (ClassNotFoundException cE) {
//System.out.println("Class Not Found Exception: "+ cE.toString());
JOptionPane.showMessageDialog(this, cE.toString());
}
Когда возникает ошибка, отображается длинное окно сообщения JOptionPane, длина которого превышает ширину экрана компьютера. Как я могу сломать e .toString () на две или более частей.