Authored by 宋文圆

修改getKPISet()中捕获异常的方法

@@ -189,31 +189,22 @@ public class SQLTarget extends CollBase { @@ -189,31 +189,22 @@ public class SQLTarget extends CollBase {
189 Vector recordSet = new Vector(); 189 Vector recordSet = new Vector();
190 PreparedStatement pstmt = null; 190 PreparedStatement pstmt = null;
191 ResultSet result = null; 191 ResultSet result = null;
192 - if (!getState()) {  
193 - return recordSet;  
194 - }  
195 -  
196 try { 192 try {
197 - pstmt = dbConnection.prepareStatement(sql);  
198 - } catch (SQLException e) {  
199 - throw new RuntimeException("Exception while exec sql :" + sql, e);  
200 - } 193 + if (!getState()) {
  194 + return recordSet;
  195 + }
201 196
202 - boolean hasResult = false;  
203 - try {  
204 - hasResult = pstmt.execute();  
205 - } catch (SQLException e) {  
206 - logger.error("pstmt.execute() has error!",e);  
207 - e.printStackTrace();  
208 - }  
209 - try { 197 + pstmt = dbConnection.prepareStatement(sql);
210 198
  199 + //避免在采集9i数据库时,在CollOracleBySql.getTableSpaces()方法中无法执行catch里面的方法,
  200 + // 将此处的捕捉异常去掉,统一捕获异常 2017-5-25 swy(代码之前是没有在这里捕获异常的)
  201 + boolean hasResult = pstmt.execute();
211 if (hasResult) { 202 if (hasResult) {
212 result = pstmt.getResultSet(); 203 result = pstmt.getResultSet();
213 ResultSetMetaData rsmd = result.getMetaData(); 204 ResultSetMetaData rsmd = result.getMetaData();
214 int iColumnCount = rsmd.getColumnCount(); 205 int iColumnCount = rsmd.getColumnCount();
215 while (result.next()) { 206 while (result.next()) {
216 - Vector vTemp = new Vector(); 207 + java.util.Vector vTemp = new Vector();
217 for (int i = 0; i < iColumnCount; i++) { 208 for (int i = 0; i < iColumnCount; i++) {
218 Object oTemp = result.getObject(i + 1); 209 Object oTemp = result.getObject(i + 1);
219 String sTemp = oTemp == null ? "" : oTemp.toString(); 210 String sTemp = oTemp == null ? "" : oTemp.toString();