|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.platform.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
|
import java.sql.SQLException;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -56,6 +57,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|
|
|
|
List<OracleConnectorParams> datainfos, GatherOracleInfo oracleModel)
|
|
|
|
|
throws Exception {
|
|
|
|
|
boolean isSuccess = false;
|
|
|
|
|
Connection conn = null;
|
|
|
|
|
try {
|
|
|
|
|
// map转 bean(汇总库信息-带tableName的)
|
|
|
|
|
// GatherOracleInfo oracleModel = oracleConnect;
|
|
|
|
@ -64,7 +66,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|
|
|
|
if (datainfos.size() == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
Connection conn = OracleConnector.connectionBuilder(
|
|
|
|
|
conn = OracleConnector.connectionBuilder(
|
|
|
|
|
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":"
|
|
|
|
|
+ oracleModel.getPort() + ":"
|
|
|
|
|
+ oracleModel.getDatabaseName(),
|
|
|
|
@ -172,6 +174,16 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
new CustomException(Custom4exception.OracleSQL_Except, e);
|
|
|
|
|
}
|
|
|
|
|
finally{
|
|
|
|
|
if(conn != null){
|
|
|
|
|
try {
|
|
|
|
|
conn.close();
|
|
|
|
|
} catch (SQLException e2) {
|
|
|
|
|
// TODO Auto-generated catch block
|
|
|
|
|
e2.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return isSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -179,7 +191,10 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|
|
|
|
public boolean isConnectTotalOracle(GatherOracleInfo oracleModel)
|
|
|
|
|
throws Exception {
|
|
|
|
|
boolean isConnect = false;
|
|
|
|
|
Connection conn = OracleConnector.connectionBuilder(
|
|
|
|
|
Exception excep = null;
|
|
|
|
|
Connection conn = null;
|
|
|
|
|
try {
|
|
|
|
|
conn = OracleConnector.connectionBuilder(
|
|
|
|
|
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":"
|
|
|
|
|
+ oracleModel.getPort() + ":"
|
|
|
|
|
+ oracleModel.getDatabaseName(), oracleModel.getUser(),
|
|
|
|
@ -193,7 +208,21 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|
|
|
|
// "]\r\n");
|
|
|
|
|
} else {
|
|
|
|
|
isConnect = oracleExtract.testConnect(conn);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
excep = e;
|
|
|
|
|
}
|
|
|
|
|
finally{
|
|
|
|
|
if(conn != null){
|
|
|
|
|
try {
|
|
|
|
|
conn.close();// 关闭连接
|
|
|
|
|
} catch (Exception e2) {
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (excep != null) {
|
|
|
|
|
throw excep;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return isConnect;
|
|
|
|
|
}
|
|
|
|
@ -201,7 +230,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean extractStandardTable(String name,
|
|
|
|
|
List<OracleConnectorParams> dataInfolist,
|
|
|
|
|
GatherOracleInfo oracleConnect) throws Exception {
|
|
|
|
|
GatherOracleInfo oracleConnect) {
|
|
|
|
|
boolean isSuccess = false;
|
|
|
|
|
// map转 bean(汇总库信息-带tableName的)
|
|
|
|
|
GatherOracleInfo oracleModel = oracleConnect;
|
|
|
|
@ -210,7 +239,9 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|
|
|
|
if (datainfos.size() == 0) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
Connection conn = OracleConnector.connectionBuilder(
|
|
|
|
|
Connection conn = null;
|
|
|
|
|
try {
|
|
|
|
|
conn = OracleConnector.connectionBuilder(
|
|
|
|
|
"jdbc:oracle:thin:@" + oracleModel.getIp() + ":"
|
|
|
|
|
+ oracleModel.getPort() + ":"
|
|
|
|
|
+ oracleModel.getDatabaseName(), oracleModel.getUser(),
|
|
|
|
@ -360,6 +391,19 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
|
|
|
|
|
+ "\r\n\r\n\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
}
|
|
|
|
|
finally{
|
|
|
|
|
if(conn != null){
|
|
|
|
|
try {
|
|
|
|
|
conn.close();// 关闭连接
|
|
|
|
|
} catch (Exception e2) {
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
isSuccess = true;
|
|
|
|
|
return isSuccess;
|
|
|
|
|
}
|
|
|
|
|