Commit d06e641f authored by Alessandro Portosa's avatar Alessandro Portosa
Browse files

Fix throwing exception when a table does not have good metadata. Now it...

Fix throwing exception when a table does not have good metadata. Now it continue to iterate over the tables
parent 03298ec2
......@@ -361,15 +361,26 @@ public class DataSourceResource extends AbstractSpagoBIResource {
logger.debug("This connection has been configured with the catalog [" + catalog + "] and schema [" + schema + "]");
rs = meta.getTables(catalog, schema, tableNamePattern, TYPES);
while (rs.next()) {
ResultSet tabCol = null;
String tableName = rs.getString(3);
JSONObject column = new JSONObject();
ResultSet tabCol = meta.getColumns(rs.getString(1), rs.getString(2), tableName, "%");
while (tabCol.next()) {
column.put(tabCol.getString(4), "null");
try {
JSONObject column = new JSONObject();
tabCol = meta.getColumns(rs.getString(1), rs.getString(2), tableName, "%");
while (tabCol.next()) {
column.put(tabCol.getString(4), "null");
}
tableContent.put(tableName, column);
} catch (Exception e) {
logger.error(
"Impossible to obtain metadata for catalog " + rs.getString(1) + ", schema " + rs.getString(2) + ", table/view " + tableName,
e);
logger.error("Continue with the other tables/views");
continue;
} finally {
if (tabCol != null) {
tabCol.close();
}
}
tabCol.close();
tableContent.put(tableName, column);
}
}
} finally {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment