简化数据库结构操作的Java API - SchemaCrawler 8.11 发布
fmms 13年前
<a href="/misc/goto?guid=4958189000824288851" target="_blank">SchemaCrawler</a>提供一组用于增强标准JDBC Metadata的API.SchemaCrawler还包含一个命令行工具能够将数据库结构和数据以一种易读的形式输出.示例代码: <pre class="brush:java; toolbar: true; auto-links: false;">final SchemaCrawlerOptions options = new SchemaCrawlerOptions(); // Set what details are required in the schema - this affects the // time taken to crawl the schema options.setSchemaInfoLevel(SchemaInfoLevel.standard()); final Database database = SchemaCrawlerUtility.getDatabase(connection, options); for (final Schema schema: database.getSchemas()) { System.out.println(schema); for (final Table table: schema.getTables()) { System.out.println("o--> " + table); for (final Column column: table.getColumns()) { System.out.println(" o--> " + column); } } }</pre>SchemaCrawler 8.11 发布, <p>8.11 版本改进记录:</p> <blockquote> This release adds the ability to configure SchemaCrawler linters and a new lint for useless surrogate keys. You can now tag tables and columns with additional metadata attributes from SQL queries. </blockquote>