java实战 连接数据库
Last updated on November 20, 2024 am
🧙 Questions
☄️Ideas
/**
* 测试数据库连接
*/
public static boolean testDatasource(String url, String username, String password) {
try {
Class.forName("com.mysql.cj.jdbc.Driver");
Connection connection = DriverManager.getConnection(url, username, password);
return connection != null;
} catch (ClassNotFoundException | SQLException e) {
return false;
}
}
🔗 Links
java实战 连接数据库
https://ispong.isxcode.com/spring/java/java实战 连接数据库/