提交 91eef920 authored 作者: taojinlong's avatar taojinlong

fix: 处理连接池为空的情况

上级 3733b869
......@@ -35,8 +35,10 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
} finally {
if(connection != null){
connection.close();
}
}
return list;
}
......@@ -52,9 +54,11 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
} finally {
if(connection != null){
connection.close();
}
}
}
@Override
public List<String[]> fetchResult(DatasourceRequest datasourceRequest) throws Exception {
......@@ -70,9 +74,11 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
} finally {
if(connection != null){
connection.close();
}
}
}
private List<String[]> fetchResult(ResultSet rs) throws Exception {
List<String[]> list = new LinkedList<>();
......@@ -110,9 +116,11 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
} finally {
if(connection != null){
connection.close();
}
}
}
@Override
public Map<String, List> fetchResultAndField(DatasourceRequest datasourceRequest) throws Exception {
......@@ -135,9 +143,11 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
} finally {
if(connection != null){
connection.close();
}
}
}
private List<TableFiled> fetchResultField(ResultSet rs) throws Exception {
List<TableFiled> fieldList = new ArrayList<>();
......@@ -175,9 +185,11 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) {
throw new Exception("ERROR: " + e.getMessage(), e);
} finally {
if(con != null){
con.close();
}
}
}
@Override
public List<TableFiled> getTableFileds(DatasourceRequest datasourceRequest) throws Exception {
......@@ -214,8 +226,10 @@ public class JdbcProvider extends DatasourceProvider {
} catch (Exception e) {
throw new Exception("ERROR:" + e.getMessage(), e);
} finally {
if(connection != null){
connection.close();
}
}
return list;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论