Skip to content
Permalink
Browse files

While looping through all catalogs in MSSQL an error is thrown while

trying to build the list of schemas and tables for each catalog if the
catalog is not accessible to the user.
  • Loading branch information...
jumpmind-josh committed May 29, 2019
1 parent 846b135 commit 98f7f304e294b59c4ebf20e7deeb12bcf19b332b
@@ -274,7 +274,7 @@ protected void removePlatformSizeAndDecimal(Column column) {
}
}

@Override
@Override
public List<String> getTableNames(final String catalog, final String schema,
final String[] tableTypes) {
StringBuilder sql = new StringBuilder("select \"TABLE_NAME\" from \"INFORMATION_SCHEMA\".\"TABLES\" where \"TABLE_TYPE\"='BASE TABLE'");
@@ -288,7 +288,7 @@ protected void removePlatformSizeAndDecimal(Column column) {
args.add(schema);
}

return platform.getSqlTemplateDirty().queryWithHandler(sql.toString(), new StringMapper(),
return schema == null ? new ArrayList<String>() : platform.getSqlTemplateDirty().queryWithHandler(sql.toString(), new StringMapper(),
new ChangeCatalogConnectionHandler(catalog) ,args.toArray(new Object[args.size()]));
}

@@ -332,7 +332,13 @@ protected void addCatalogNodes(IDdlReader reader, DbTreeNode parent, IDatabasePl
DbTreeNode catalogNode = new DbTreeNode(this, catalog, NODE_TYPE_CATALOG, FontAwesome.BOOK, parent);
parent.getChildren().add(catalogNode);

List<String> catalogSchemaChildren = reader.getSchemaNames(catalogNode.getName());

List<String> catalogSchemaChildren = new ArrayList<String>();
try {
catalogSchemaChildren = reader.getSchemaNames(catalogNode.getName());
} catch (Exception e) {
log.debug("Unable to get schemas for catalog " + catalogNode.getName(), e);
}
if(catalogSchemaChildren.size() == 0){
List<DbTreeNode> catalogTableChildren = getTableTreeNodes(reader,catalogNode,catalogNode.getName(),null);
if(catalogTableChildren.size() == 0){

0 comments on commit 98f7f30

Please sign in to comment.
You can’t perform that action at this time.