fix: issue(#668)修复连接未关闭问题

This commit is contained in:
Star Zheng 2023-03-26 17:16:27 +08:00
parent a48fa9f6ed
commit 14cb76e5f3

View File

@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -120,9 +121,15 @@ public final class OriginalConfPretreatmentUtil {
} else { } else {
// 确保用户配置的 column 不重复 // 确保用户配置的 column 不重复
ListUtil.makeSureNoValueDuplicate(userConfiguredColumns, false); ListUtil.makeSureNoValueDuplicate(userConfiguredColumns, false);
Connection connection = null;
try {
connection = connectionFactory.getConnecttion();
// 检查列是否都为数据库表中正确的列通过执行一次 select column from table 进行判断
DBUtil.getColumnMetaData(connection, oneTable,StringUtils.join(userConfiguredColumns, ","));
} finally {
DBUtil.closeDBResources(null, connection);
}
// 检查列是否都为数据库表中正确的列通过执行一次 select column from table 进行判断
DBUtil.getColumnMetaData(connectionFactory.getConnecttion(), oneTable,StringUtils.join(userConfiguredColumns, ","));
} }
} }
} }