datasource

Raod 3 years ago
parent 5505368dfe
commit c777c0bb5a

@ -130,7 +130,7 @@ public class DataSetServiceImpl implements DataSetService {
JSONObject jsonObject = jsonArray.getJSONObject(0);
dto.setSetParamList(jsonObject.keySet());
} catch (Exception e) {
log.error("{}",e);
log.error("error",e);
}
}
return dto;

@ -61,10 +61,11 @@ public class JdbcUtil {
try {
DruidDataSource pool = map.get(id);
if (pool != null) {
log.info("remove pool success, datasourceId:{}", id);
map.remove(id);
}
} catch (Exception e) {
log.error("{}",e);
log.error("error",e);
} finally {
}
}

@ -94,6 +94,7 @@ public class DataSourceServiceImpl implements DataSourceService {
break;
case JdbcConstants.MYSQL:
case JdbcConstants.KUDU_IMAPLA:
case JdbcConstants.ORACLE:
testRelationalDb(dto);
break;
case JdbcConstants.HTTP:
@ -115,6 +116,7 @@ public class DataSourceServiceImpl implements DataSourceService {
return executeElasticsearchSql(dto);
case JdbcConstants.MYSQL:
case JdbcConstants.KUDU_IMAPLA:
case JdbcConstants.ORACLE:
return executeRelationalDb(dto);
case JdbcConstants.HTTP:
return executeHttp(dto);
@ -176,7 +178,7 @@ public class DataSourceServiceImpl implements DataSourceService {
try {
exchange = restTemplate.exchange(dto.getApiUrl(), HttpMethod.valueOf(dto.getMethod()), entity, JSONObject.class);
} catch (Exception e) {
log.error("{}",e);
log.error("error",e);
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_CONNECTION_FAILED, e.getMessage());
}
if (exchange.getStatusCode().isError()) {
@ -203,7 +205,7 @@ public class DataSourceServiceImpl implements DataSourceService {
result.add(jsonObject);
}
} catch (Exception e) {
log.error("{}",e);
log.error("error",e);
throw BusinessExceptionBuilder.build(ResponseCode.ANALYSIS_DATA_ERROR, e.getMessage());
}
return result;
@ -233,7 +235,7 @@ public class DataSourceServiceImpl implements DataSourceService {
Object value = rs.getObject(t);
jo.put(t, value);
} catch (SQLException throwable) {
log.error("{}",throwable);
log.error("error",throwable);
throw BusinessExceptionBuilder.build(ResponseCode.EXECUTE_SQL_ERROR, throwable.getMessage());
}
});
@ -241,7 +243,7 @@ public class DataSourceServiceImpl implements DataSourceService {
}
return list;
} catch (Exception throwable) {
log.error("{}",throwable);
log.error("error",throwable);
throw BusinessExceptionBuilder.build(ResponseCode.EXECUTE_SQL_ERROR, throwable.getMessage());
} finally {
try {
@ -249,7 +251,7 @@ public class DataSourceServiceImpl implements DataSourceService {
pooledConnection.close();
}
} catch (SQLException throwable) {
log.error("{}",throwable);
log.error("error",throwable);
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_CONNECTION_FAILED, throwable.getMessage());
}
}
@ -269,7 +271,7 @@ public class DataSourceServiceImpl implements DataSourceService {
try {
exchange = restTemplate.exchange(dto.getApiUrl(), HttpMethod.valueOf(dto.getMethod()), entity, JSONObject.class);
} catch (Exception e) {
log.error("{}",e);
log.error("error",e);
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_CONNECTION_FAILED, e.getMessage());
}
if (exchange.getStatusCode().isError()) {
@ -294,7 +296,7 @@ public class DataSourceServiceImpl implements DataSourceService {
log.info("数据库测试连接成功:{}", catalog);
unPooledConnection.close();
} catch (Exception e) {
log.error("{}",e);
log.error("error",e);
throw BusinessExceptionBuilder.build(ResponseCode.DATA_SOURCE_CONNECTION_FAILED, e.getMessage());
}
}
@ -400,10 +402,6 @@ public class DataSourceServiceImpl implements DataSourceService {
*/
@Override
public void processAfterOperation(DataSource entity, BaseOperationEnum operationEnum) throws BusinessException {
switch (operationEnum){
case DELETE:
JdbcUtil.removeJdbcConnectionPool(entity.getId());
break;
}
}
}

@ -23,7 +23,7 @@ public class FileUtils {
bos.close();
buffer = bos.toByteArray();
} catch (IOException e) {
log.error("{}", e);
log.error("error", e);
}
return buffer;
}

@ -83,7 +83,7 @@ public class UserServiceImpl implements UserService {
}
return result.toString();
} catch (Exception e) {
log.error("{}",e);
log.error("error",e);
}
return "";
}

Loading…
Cancel
Save