如果失败我想重新连接数据库。我该怎么做?
尝试{
String dbURL = "jdbc:mysql://127.0.0.1:5016";
dbConmysql = DriverManager.getConnection(dbURL, "root", "root");
} catch (SQLException e) {
System.out.println(e.getMessage());
System.exit(0);
}
最佳答案
如果显示任何错误,可以使用while
关于mysql - "retry mysql database connection if fail"的 Java 代码帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42048911/