基于JDBC的數據庫結構提取工具,SchemaCrawler 9.0 發布
SchemaCrawler提供一組用于增強標準JDBC Metadata的API.SchemaCrawler還包含一個命令行工具能夠將數據庫結構和數據以一種易讀的形式輸出.
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: database.getTables(schema)) { System.out.print("o--> " + table); for (final Column column: table.getColumns()) { System.out.println(" o--> " + column); } } }
SchemaCrawler 9.0 發布,該版本的 API 進行了修改,所有 API 的調用返回集合而不是數組,Schemas 也不再是容器,使用標簽來作為數據庫對象,允許直接在命令行上查詢,-procedures 改為 -routines 等等。
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!