在 Web 应用程序中可视化 schemacrawler 输出的方法

Way to visualize schemacrawler output in web application

任何人都可以建议一种在 Web 应用程序中可视化 schemacrawler 输出的好方法。我需要输出为 ER diragram。有什么好的 javascript 或 jquery 使用 DOT 格式的插件吗?当我尝试以点格式获取输出时,还有一件事是输出为

系统信息

SchemaCrawler 信息 -=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--= --=--=--=--=--=--=--=-

产品名称 SchemaCrawler
产品版本 12.04.02

数据库信息 -=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--= --=--=--=--=--=--=--=-

数据库产品名称MySQL
数据库产品版本 5.6.19-0ubuntu0.14.04.1
数据库用户名 demo@localhost

JDBC Driver 信息 -=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--= --=--=--=--=--=--=--=-

driver 名称 MySQL 连接器 Java
driver 版本 mysql-connector-java-5.1.34(修订版:jess.balint@oracle.com-20141014163213-wqbwpf1ok2kvo1om) driver class 姓名 com.mysql.jdbc.Driver
url jdbc:mysql://localhost:3306/demodb JDBC 合规 false

表格

demodb.dbconnection

                                                             [table]

id INT NOT NULL
auto-incremented
dbmsType VARCHAR(100)
ipAddress VARCHAR(100)
端口 VARCHAR(10)
用户名 VARCHAR(100)
这个table用来存放数据库连接 密码 VARCHAR(100)
数据库名称 VARCHAR(100)

                                                       [primary key]

id 升序
auto-incremented

demodb.roles

                                                             [table]

roleId INT NOT NULL
角色名称 VARCHAR(45) NOT NULL

                                                       [primary key]

roleId 升序

demodb.userdetails

                                                             [table]

id INT NOT NULL
auto-incremented
名称 VARCHAR(45)
出生日期
性别 VARCHAR(1)
血型 VARCHAR(5)
地址 VARCHAR(45)
放置 VARCHAR(45)
城市 VARCHAR(45)
状态 VARCHAR(45)
国家 VARCHAR(45)
邮政编码 VARCHAR(45)
移动 VARCHAR(45)
电子邮件 VARCHAR(45)
职业 VARCHAR(45)

                                                       [primary key]

id 升序
auto-incremented

                                       [foreign key, with no action]

id <-- demodb.user.userDetailsId

demodb.userroles

                                                             [table]

id INT NOT NULL
auto-incremented
用户名 VARCHAR(45) NOT NULL
角色名称 VARCHAR(45) NOT NULL

                                                       [primary key]

id 升序
auto-incremented

demodb.user

                                                             [table]

用户名 VARCHAR(100) NOT NULL
密码 VARCHAR(300) NOT NULL
userDetailsId INT NOT NULL
活动 INT NOT NULL

                                                       [primary key]

用户名升序

                                       [foreign key, with no action]

userDetailsId --> demodb.userdetails.id

                                                  [non-unique index]

userDetailsId 升序

                                                      [unique index]

用户名升序

我的schemacrawler-context.xml就像

<bean id="outputOptions" class="schemacrawler.tools.options.OutputOptions">
    <property name="outputFormatValue" value="DOT" />
    <!-- <property name="outputFile" value="scOutput.txt" /> --><!-- This should be given(writer not file) given from the program. -->
</bean>

它不适用于 DOT 和 dot

卡德尔,

对于 Web 输出,SchemaCrawler 提供了一些开箱即用的输出选项。一种选择是以 "htmlx" 格式生成输出,这将在单个文件中为您提供嵌入 HTML 的 ER 图。另一种选择是使用 "png" 格式生成 PNG 文件。很难在 Spring 上下文中看到你有什么可执行文件,因为你没有在你的问题中包含这个关键信息。我建议您使用 GraphExecutable。

请注意,为了生成 ER 图,您需要 GraphViz installed on the web server. GraphViz will always generate a file, and cannot use a Java writer. So, please use the most appropriate constructor for OutputOptions

如果您愿意,可以让SchemaCrawler 生成DOT 格式。同样,请使用最适合 OutputOptions. You do not need GraphViz for this. You can use viz.js 的构造函数来使用 JavaScript.

可视化 DOT 文件

希望这对您有所帮助。

苏阿莱赫·法塔希,SchemaCrawler