0
我正在參考http://sualeh.github.io/SchemaCrawler/how-to.html#api 中的文檔但我從來沒有得到我想要的。返回的表總是空的。當使用API時,SchemaCrawler是否被破壞?
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);
}
MySQL有沒有模式,只有目錄(在JDBC項)。你應該使用'getCatalogs()'而不是'getSchemas()' –