我在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);
}
答案 0 :(得分:1)
您不应该设置表名模式,因此请删除以下行:
options.setTableNamePattern("*");
Sualeh Fatehi,SchemaCrawler