增加数据源管理

This commit is contained in:
YunaiV
2022-04-27 23:15:43 +08:00
parent c402077961
commit 7ce7baa2d2
24 changed files with 794 additions and 3 deletions

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.framework.mybatis.core.util;
import java.sql.Connection;
import java.sql.DriverManager;
/**
* 数据库工具类
*
* @author 芋道源码
*/
public class DatabaseUtils {
/**
* 判断连接是否正确
*
* @param url 数据源连接
* @param username 账号
* @param password 密码
* @return 是否正确
*/
public static boolean isConnectionOK(String url, String username, String password) {
try (Connection ignored = DriverManager.getConnection(url, username, password)) {
return true;
} catch (Exception ex) {
return false;
}
}
}