首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >生成数据库ER图所需的Java API

生成数据库ER图所需的Java API
EN

Stack Overflow用户
提问于 2012-03-08 16:51:42
回答 2查看 2.8K关注 0票数 1

有没有java API/java插件可以在提供java连接对象作为输入时生成数据库ER图。

例如:InputSream generateDatabaseERDiagram(java connection object)// where inputsream will point to generated ER diagram image

API应该与oracle、mysql、postgresql?

我正在使用schemacrawler(http://schemacrawler.sourceforge.net/)工具,但我没有得到任何可以做到这一点的API。

如果没有这样的API,那么让我知道如何编写我自己的API?我想为数据库中的所有模式或任何特定模式生成ER图,如果模式名称作为输入提供的话。

如果你对如何完成这项任务有所了解,这将是很有帮助的。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-03-08 17:07:29

如果我没理解错你的问题,你可以看一下:JGraph

票数 2
EN

Stack Overflow用户

发布于 2015-10-22 17:32:23

这是一个老问题,但以防其他人像我一样偶然发现它,我最终找到了如何使用Schemacrawler的java API生成ERD。

代码语言:javascript
复制
            //Get your java connection however
            Connection conn = DriverManager.getConnection("DATABASE URL");
            SchemaCrawlerOptions options = new SchemaCrawlerOptions();
            // Set what details are required in the schema - this affects the
            // time taken to crawl the schema
            options.setSchemaInfoLevel(SchemaInfoLevelBuilder.standard());
            // you can exclude/include objects using the options object e.g.
            //options.setTableInclusionRule(new RegularExpressionExclusionRule(".*qrtz.*||.*databasechangelog.*"));

            GraphExecutable ge = new GraphExecutable();

            ge.setSchemaCrawlerOptions(options);

            String outputFormatValue = GraphOutputFormat.png.getFormat();

            OutputOptions outputOptions = new OutputOptions(outputFormatValue, new File("database.png").toPath());

            ge.setOutputOptions(outputOptions);

            ge.execute(conn);

这仍然需要安装graphviz并在path上工作。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9614957

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档