修复gfs连接问题

web_backend_develope
chenlw 9 years ago
parent 9b311366a5
commit 6aa31f96f5

@ -4,7 +4,7 @@
# 驱动程序
jdbc.mysql.driver=com.mysql.jdbc.Driver
# 连接url
jdbc.mysql.url=jdbc:mysql://127.0.0.1:3306/extend_glusterfs?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
jdbc.mysql.url=jdbc:mysql://192.168.0.110:3306/ftpdata?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
# 用户名
jdbc.mysql.username=root
# 密码
@ -46,11 +46,11 @@ gather-tablespace-name=TS_TTSSS
gather-tablespace-path=
gather-table-user-password=
kubeMasterUrl=http://192.168.191.23:8080/
kubeMasterUrl=http://192.168.0.110:8080/
collect-user-name=system
collect-password=oracle
collect-service-name=orcl
gfs_control_ip=192.168.191.23
gfs_control_ip=192.168.0.110
gfs_control_rootPassWd=root

@ -8,6 +8,7 @@ import java.sql.Statement;
import com.base.Custom4exception;
import com.base.CustomException;
import com.platform.entities.OracleConnectorParams;
import com.platform.utils.Configs;
import com.platform.utils.FileOperateHelper;
@ -25,19 +26,23 @@ public class OracleConnector {
public synchronized static Connection ConnectionBuilder(String url, String user,
String password) {
String password, OracleConnectorParams oc) {
Connection conn=null;
try {
conn = DriverManager.getConnection(url, user, password);
} catch (SQLException e) {
new CustomException(Custom4exception.OracleSQL_Except, e);
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage() + "]");
if (null != oc) {
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
+ oc.getName(), "创建oracle连接失败: [" + e.getMessage() + "]\r\n");
}
}
return conn;
}
public synchronized static boolean canConnect(String url, String user, String password) {
return (null != ConnectionBuilder(url, user, password));
return (null != ConnectionBuilder(url, user, password, null));
}
public synchronized static ResultSet getSQLExecResultSet(Connection conn, String sql, String filePath) {
@ -60,7 +65,7 @@ public class OracleConnector {
public synchronized static ResultSet getSQLExecResultSet(String url, String user,
String password, String sql, String filePath) {
return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql, filePath);
return getSQLExecResultSet(ConnectionBuilder(url, user, password, null), sql, filePath);
}
/**

@ -13,7 +13,7 @@ public class OracleExtractService extends Thread implements Runnable {
public OracleExtractService(OracleConnectorParams ocp){
this.ocp=ocp;
String url = "";
this.conn=OracleConnector.ConnectionBuilder(url, Configs.GATHER_USER_NAME, Configs.GATHER_USER_PASSWORD);
this.conn=OracleConnector.ConnectionBuilder(url, Configs.GATHER_USER_NAME, Configs.GATHER_USER_PASSWORD, null);
}
@Override
public void run() {

@ -19,6 +19,7 @@ import com.platform.service.IOracleExtractService;
import com.platform.service.OracleExtractHelper;
import com.platform.utils.Configs;
import com.platform.utils.Constant;
import com.platform.utils.FileOperateHelper;
@Service(value = "OracleExtract")
public class OracleExtractServiceImpl implements IOracleExtractService {
@ -48,8 +49,16 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
GatherOracleInfo oracleModel = oracleConnect;
//采集库连接参数
List<OracleConnectorParams> datainfos = dataInfolist;
if (datainfos.size() == 0) {
return false;
}
Connection conn = OracleConnector.ConnectionBuilder("jdbc:oracle:thin:@" + oracleModel.getIp() + ":" + oracleModel.getPort() + ":"
+ oracleModel.getDatabaseName(), oracleModel.getUser(), oracleModel.getPassword());
+ oracleModel.getDatabaseName(), oracleModel.getUser(), oracleModel.getPassword(),dataInfolist.get(0));
if (null == conn) {
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
+ dataInfolist.get(0).getName(), "创建oracle连接失败: [" + conn + "]\r\n");
return false;
}
for (OracleConnectorParams collectOracle : datainfos) {
if(null != collectOracle.getDataId() && !"".equals(collectOracle.getDataId())){

@ -145,7 +145,9 @@ public class GanymedSSH {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
sess.close();
if (null != sess) {
sess.close();
}
}
return reStrings;

Loading…
Cancel
Save