mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 23:52:00 +08:00
Merge 2b3255bc23
into 0824b45c5e
This commit is contained in:
commit
86560373c2
@ -7,9 +7,9 @@ import java.sql.Connection;
|
|||||||
*/
|
*/
|
||||||
public interface ConnectionFactory {
|
public interface ConnectionFactory {
|
||||||
|
|
||||||
public Connection getConnecttion();
|
public Connection getConnection();
|
||||||
|
|
||||||
public Connection getConnecttionWithoutRetry();
|
public Connection getConnectionWithoutRetry();
|
||||||
|
|
||||||
public String getConnectionInfo();
|
public String getConnectionInfo();
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@ public class JdbcConnectionFactory implements ConnectionFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection getConnecttion() {
|
public Connection getConnection() {
|
||||||
return DBUtil.getConnection(dataBaseType, jdbcUrl, userName, password);
|
return DBUtil.getConnection(dataBaseType, jdbcUrl, userName, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection getConnecttionWithoutRetry() {
|
public Connection getConnectionWithoutRetry() {
|
||||||
return DBUtil.getConnectionWithoutRetry(dataBaseType, jdbcUrl, userName, password);
|
return DBUtil.getConnectionWithoutRetry(dataBaseType, jdbcUrl, userName, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ public final class OriginalConfPretreatmentUtil {
|
|||||||
boolean isPreCheck = originalConfig.getBool(Key.DRYRUN, false);
|
boolean isPreCheck = originalConfig.getBool(Key.DRYRUN, false);
|
||||||
List<String> allColumns;
|
List<String> allColumns;
|
||||||
if (isPreCheck){
|
if (isPreCheck){
|
||||||
allColumns = DBUtil.getTableColumnsByConn(DATABASE_TYPE,connectionFactory.getConnecttionWithoutRetry(), oneTable, connectionFactory.getConnectionInfo());
|
allColumns = DBUtil.getTableColumnsByConn(DATABASE_TYPE,connectionFactory.getConnectionWithoutRetry(), oneTable, connectionFactory.getConnectionInfo());
|
||||||
}else{
|
}else{
|
||||||
allColumns = DBUtil.getTableColumnsByConn(DATABASE_TYPE,connectionFactory.getConnecttion(), oneTable, connectionFactory.getConnectionInfo());
|
allColumns = DBUtil.getTableColumnsByConn(DATABASE_TYPE,connectionFactory.getConnection(), oneTable, connectionFactory.getConnectionInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("table:[{}] all columns:[\n{}\n].", oneTable,
|
LOG.info("table:[{}] all columns:[\n{}\n].", oneTable,
|
||||||
@ -123,7 +123,7 @@ public final class OriginalConfPretreatmentUtil {
|
|||||||
ListUtil.makeSureNoValueDuplicate(userConfiguredColumns, false);
|
ListUtil.makeSureNoValueDuplicate(userConfiguredColumns, false);
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
try {
|
try {
|
||||||
connection = connectionFactory.getConnecttion();
|
connection = connectionFactory.getConnection();
|
||||||
// 检查列是否都为数据库表中正确的列(通过执行一次 select column from table 进行判断)
|
// 检查列是否都为数据库表中正确的列(通过执行一次 select column from table 进行判断)
|
||||||
DBUtil.getColumnMetaData(connection, oneTable,StringUtils.join(userConfiguredColumns, ","));
|
DBUtil.getColumnMetaData(connection, oneTable,StringUtils.join(userConfiguredColumns, ","));
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user