有没有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图,如果模式名称作为输入提供的话。
如果你对如何完成这项任务有所了解,这将是很有帮助的。
发布于 2012-03-08 17:07:29
如果我没理解错你的问题,你可以看一下:JGraph
发布于 2015-10-22 17:32:23
这是一个老问题,但以防其他人像我一样偶然发现它,我最终找到了如何使用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);这仍然需要安装graphviz并在path上工作。
https://stackoverflow.com/questions/9614957
复制相似问题