java代码连库卡死,哪位遇到帮分析下?
System.out.printf("-------------- start connection db-------%s--------%n", dbInfo.getDesc());
卡死在这一行,代码不再向下走
try (Connection connection = DriverManager.getConnection(dbInfo.getUrl(), dbInfo.getUser(), dbInfo.getPwd())😉 {
System.out.printf("%s:connection db success!!!%n", dbInfo.getDesc());
out.println("数据库连接成功");
// 创建一个简单的查询
Statement statement = connection.createStatement();
statement.execute("SELECT 1");
System.out.printf("%s:query db success!!!%n", dbInfo.getDesc());
out.println("测试查询成功");
} catch (SQLException e) {
System.out.printf("%s:数据库连接或查询失败 %s %n", dbInfo.getDesc(), e.getMessage());
// e.printStackTrace();
out.println("数据库连接或查询失败: " + e.getMessage());
}
增加额DriverManager得日志输出,卡在这里
[2024-07-16 10:22:57] [INFO] [System.out] [ skipping: java.sql.DriverInfo
]
[2024-07-16 10:22:57] [INFO] [System.out] [ skipping: java.sql.DriverInfo
]
[2024-07-16 10:22:57] [INFO] [System.out] [ trying dm.jdbc.driver.DmDriver
文章
阅读量
获赞