0

I am refering the doc in http://sualeh.github.io/SchemaCrawler/how-to.html#api But I never get what I want. The tables returned is always empty.

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);
}
user1040933
  • 277
  • 5
  • 14
  • MySQL has no schemas, only catalogs (in JDBC terms). You should use `getCatalogs()` not `getSchemas()` –  Apr 01 '17 at 11:51

1 Answers1

1

You should not set the table name pattern, so please remove the following line: options.setTableNamePattern("*");

Sualeh Fatehi, SchemaCrawler

Sualeh Fatehi
  • 4,700
  • 2
  • 24
  • 28