使用PowerDesigner16.5 逆向数据库生产表结构或导出word文档
一:PowerDesigner16.5及JDK1.8 32位下载地址

二:安装PowerDesigner
说明:因为PD是32位的,使用JDBC连接数据库时候也需要运行在32位的Java虚拟机上。一般我们机器上安装的都是64位的,所以需要安装32位JDK不用添加到系统变量中,只需要在启动PD的时候将这个环境变量set就可以。
从网盘中下载PD,JDK,启动脚本。安装完成后,对PD进行破解。将启动脚本放置在安装目录中如:D:\Program Files (x86)\Sybase\PowerDesigner 16
修改启动脚本:
set JAVA_HOME=D:\softexe\JDK32_jb51
set CLASSPATH=D:\Program Files (x86)\Sybase\PowerDesigner 16\mysql-connector-java-5.1.25-bin.jar
cd "D:\Program Files (x86)\Sybase\PowerDesigner 16"
start /b PdShell16.exe
exit
说明:
1:java_home修改成自己解压后32位JDK的位置
2:mysql-connector-java-5.1.25-bin.jar:最好把mysql连接放到PD安装目录下。
修改完成之后,将启动脚本发送快捷方式到桌面。下次启动的时候,直接在桌面点击启动脚本即可。
三:连接数据库
3.1:启动
双击启动脚本后,启动PD.选择Create Model..。

选择Model types / Physical Data Model Physical Diagram:

Model name:新建模块名称
DBMS:需要选择对应的数据库版本 mysql最高支持的是5.0
3.2:连接数据库配置
3.2.1:选择connect
在工具栏选择Database-Connect... 快捷键:ctrl+shift+N.如下图:

3.2.2:选择配置连接configure
在弹出的窗口选择Connection profile: configure...

在弹出框中选择第二个:新建

如下图:

说明:
Connection profile name:连接配置文件的名称
Directory:配置文件保存位置
Description:描述
Connection type:连接类型

选择JDBC后:

user name:数据库用户名
jdbc driver class:连接driver(mysql:com.mysql.jdbc.Driver)
jdbc connection url:数据库连接URL(mysql:jdbc:mysql://数据库ip:数据库端口/数据库)
jdbc dirver jar files:驱动jar(我们已经在启动脚本中添加了,这里就可以不用添加)
填写完以上信息后,可以 Test Connection...进行测试:

输入密码,点击OK.

说明连接成功。
四:从数据库中逆向表结构
4.1连接数据库
File-Reverse Engineer-Database... 如下图:


4.2选择上一步已经配置好的数据库连接

4.2.1选择第三步创建的脚本后,输入数据库用户名的密码


4.2.2选中后,点击确认:

会列出当前数据库用户的所有表
4.2.3可以选中指定用户的

4.2.4全选或全不选
4.2.4.1全选

4.2.4.2全不选

4.3:修改生成表的字段

MYSQL50::Script\Objects\Table\SqlListQuery

看看有没有TNAME。如果没有就添加脚本:

添加完成后,重新选着表,然后就可以生成表结构了。

五:自定义导出word模板
待续