mirror of https://gitee.com/stylefeng/roses
【8.0】【db】修复db链接配置
parent
e6efcd79f6
commit
aaf886e7d9
|
@ -24,6 +24,8 @@
|
||||||
*/
|
*/
|
||||||
package cn.stylefeng.roses.kernel.dsctn.persist;
|
package cn.stylefeng.roses.kernel.dsctn.persist;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
@ -163,23 +165,21 @@ public class DataBaseInfoPersistence {
|
||||||
*/
|
*/
|
||||||
private DruidProperties createDruidProperties(ResultSet resultSet) {
|
private DruidProperties createDruidProperties(ResultSet resultSet) {
|
||||||
|
|
||||||
DruidProperties druidProperties = new DruidProperties();
|
DruidProperties newDruidProperties = new DruidProperties();
|
||||||
|
BeanUtil.copyProperties(this.druidProperties, newDruidProperties, CopyOptions.create().ignoreError());
|
||||||
druidProperties.setTestOnBorrow(true);
|
|
||||||
druidProperties.setTestOnReturn(true);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
druidProperties.setDriverClassName(resultSet.getString("jdbc_driver"));
|
newDruidProperties.setDriverClassName(resultSet.getString("jdbc_driver"));
|
||||||
druidProperties.setUrl(resultSet.getString("jdbc_url"));
|
newDruidProperties.setUrl(resultSet.getString("jdbc_url"));
|
||||||
druidProperties.setUsername(resultSet.getString("username"));
|
newDruidProperties.setUsername(resultSet.getString("username"));
|
||||||
druidProperties.setPassword(resultSet.getString("password"));
|
newDruidProperties.setPassword(resultSet.getString("password"));
|
||||||
} catch (SQLException exception) {
|
} catch (SQLException exception) {
|
||||||
log.info("根据数据库查询结果,创建DruidProperties失败!", exception);
|
log.info("根据数据库查询结果,创建DruidProperties失败!", exception);
|
||||||
String userTip = StrUtil.format(DatasourceContainerExceptionEnum.CREATE_PROP_DAO_ERROR.getUserTip(), exception.getMessage());
|
String userTip = StrUtil.format(DatasourceContainerExceptionEnum.CREATE_PROP_DAO_ERROR.getUserTip(), exception.getMessage());
|
||||||
throw new DatasourceContainerException(DatasourceContainerExceptionEnum.CREATE_PROP_DAO_ERROR, userTip);
|
throw new DatasourceContainerException(DatasourceContainerExceptionEnum.CREATE_PROP_DAO_ERROR, userTip);
|
||||||
}
|
}
|
||||||
|
|
||||||
return druidProperties;
|
return newDruidProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue