Java开源的数据库结构操作框架 SchemaCrawler 8.8 发布
openkk 13年前
<p>SchemaCrawler提供一组用于增强标准JDBC Metadata的API.SchemaCrawler还包含一个命令行工具能够将数据库结构和数据以一种易读的形式输出.</p> <p>新版本支持输出 JSON 格式的数据库结构,便于在网站上发布;另外 SchemaCrawler Maven 插件不再单独分开成一个独立的项目。<br /> <img title="Java开源的数据库结构操作框架 SchemaCrawler 8.8 发布" border="0" alt="Java开源的数据库结构操作框架 SchemaCrawler 8.8 发布" src="https://simg.open-open.com/show/29d5f8704a14bf80c354882a7029bd26.png" width="360" height="62" /><br /> <span style="font-weight:bold;">项目地址</span>:<a href="/misc/goto?guid=4958189000824288851" target="_blank">http://schemacrawler.sourceforge.net/</a></p> <div class="section"> <h3>SchemaCrawler<a name="SchemaCrawler"></a></h3> <p>SchemaCrawler is an open-source Java API that makes working with database metadata as easy as working with plain old Java objects. </p> <p>SchemaCrawler is also a database schema discovery and comprehension, and schema documentation tool. You can search for database schema objects using regular expressions, and output the schema and data in a readable text format. The output is designed to be <a class="externalLink" href="/misc/goto?guid=4958193985260984576">diff-ed</a> against other database schemas. </p> </div> <h3>SchemaCrawler API<a name="SchemaCrawler_API"></a></h3> <p>Java programmers need to access database metadata </p> <ul> <li>in order to dynamically generate SQL statements</li> <li>when programmatically determining the capabilities of a given RDBMS </li> <li>when finding the names and types of tables and columns in the database </li> </ul> <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> <br />