Mysql SchemaCrawler在使用其API时是否已损坏?
我指的是医生 但我从未得到我想要的。返回的表总是空的Mysql SchemaCrawler在使用其API时是否已损坏?,mysql,jdbc,schemacrawler,Mysql,Jdbc,Schemacrawler,我指的是医生 但我从未得到我想要的。返回的表总是空的 final Connection connection = ... // Get a MYSQL connection; final SchemaCrawlerOptions options = new SchemaCrawlerOptions(); options.setSchemaInfoLevel(SchemaInfoLevelBuilder.maximum()); options.setTableInclusionRule(new I
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连接;
final SchemaCrawlerOptions=新SchemaCrawlerOptions();
options.setSchemaInfoLevel(SchemaInfoLevelBuilder.max());
options.setTableInclusionRule(新includeal());
options.setTableNamePattern(“*”);
最终目录Catalog=SchemaCrawlerUtility.getCatalog(连接,选项);
for(最终架构:catalog.getSchemas())
{
集合表=catalog.getTables(schema);
//
//表的大小始终为0
//
系统输出打印LN(表格);
}
您不应该设置表名模式,因此请删除以下行:
options.setTableNamePattern(“*”);
Sualeh Fatehi,MySQL没有模式,只有目录(用JDBC术语)。您应该使用
getCatalogs()
而不是getSchemas()
谢谢Sualeh,这真的很有帮助