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

生成数据库ER图所需的Java API,java,database,graph,schemacrawler,Java,Database,Graph,Schemacrawler,当提供java连接对象作为输入时,是否有任何java API/java插件可以生成数据库ER图 例如:InputSream generateDatabaseERDiagram(java连接对象)//其中InputSream将指向生成的ER图图像 API应该与oracle、mysql、postgresql一起使用 我正在经历一场阴谋(http://schemacrawler.sourceforge.net/)工具,但没有任何API可以做到这一点 如果没有像这样的API,那么让我知道如何编写自己的A

当提供java连接对象作为输入时,是否有任何java API/java插件可以生成数据库ER图

例如:
InputSream generateDatabaseERDiagram(java连接对象)//其中InputSream将指向生成的ER图图像

API应该与oracle、mysql、postgresql一起使用

我正在经历一场阴谋(http://schemacrawler.sourceforge.net/)工具,但没有任何API可以做到这一点

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


如果你能说明如何完成这项任务,这将是非常有帮助的。

如果我正确理解了你的问题,你可以看看:

如果我正确理解了你的问题,您可能会看到:

这是一个老问题,但如果其他人像我尝试做同样的事情时一样偶然发现它,我最终找到了如何使用Schemacrawler的java API生成ERD

            //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);

这仍然需要安装并在工作的路径上。

这是一个老问题,但如果其他人像我尝试做同样的事情时一样偶然发现它,我最终找到了如何使用Schemacrawler的java API生成ERD

            //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);

这仍然需要安装并在工作路径上。

schemacrawler看起来很有希望。考虑使用这个例子,把图像写到一个临时文件夹中,然后用java应用程序打开它。我理解了在模式爬虫中给出的例子吗?我是指在模式爬虫中使用哪种API来生成ER图?你能把这个示例代码粘贴到这里吗?只有我在schemacrawler final Database Database=SchemaCrawlerUtility.getDatabase(连接,选项)中没有安装这个API;对于(最终的模式:database.getSchemas()){}我知道这个API可以用来在模式、表、列etcschemacrawler中爬行。考虑使用这个例子,把图像写到一个临时文件夹中,然后用java应用程序打开它。我理解了在模式爬虫中给出的例子吗?我是指在模式爬虫中使用哪种API来生成ER图?你能把这个示例代码粘贴到这里吗?只有我在schemacrawler final Database Database=SchemaCrawlerUtility.getDatabase(连接,选项)中没有安装这个API;对于(最终模式:database.getSchemas()){}我知道这个API可以用来爬网模式、表、列等