SchemaCrawler在使用其API时是否已损坏?

时间:2017-04-01 11:50:06

标签: mysql jdbc schemacrawler

我在http://sualeh.github.io/SchemaCrawler/how-to.html#api中引用该文档 但我从来没有得到我想要的东西。返回的表总是空的。

final Connection connection = ... // Get a MYSQL connection;
final SchemaCrawlerOptions options = new SchemaCrawlerOptions();
options.setSchemaInfoLevel(SchemaInfoLevelBuilder.maximum());
options.setTableInclusionRule(new IncludeAll());
options.setTableNamePattern("*");

final Catalog catalog = SchemaCrawlerUtility.getCatalog(connection, options);

for (final Schema schema: catalog.getSchemas())
{
    Collection<Table> tables = catalog.getTables(schema);
    // 
    // The size of tables is always 0
    // 
    System.out.println(tables);
}

1 个答案:

答案 0 :(得分:1)

您不应该设置表名模式,因此请删除以下行: options.setTableNamePattern("*");

Sualeh Fatehi,SchemaCrawler