Step 1 :首先下載mysql-connector-odbc-3.51.27-win32.msi ,然后進(jìn)行程序的安裝重抖。安裝完畢之后打開(kāi)控制面板,在打開(kāi)管理工具宴偿,打開(kāi)數(shù)據(jù)庫(kù)源ODBC選擇添加按鈕選擇對(duì)應(yīng)的數(shù)據(jù)庫(kù)(以Mysql為例),然后進(jìn)行Mysql配置诀豁,相當(dāng)于在Myeclipse下配置數(shù)據(jù)源一樣的方法窄刘。
Step 2:打開(kāi)powerdesigner。選擇file--->reverse engineer--->database
Step 3:在彈出的對(duì)話框new physic data model里填寫你自己的modelname舷胜,選擇dbms為mysql5點(diǎn)擊確定
Step 4:在彈出的?database reverse engineer selection 里選using a data source 并點(diǎn)擊connect to a data source彈出connect to a data source對(duì)話框.
Step 5:選擇data source 為odbc machine data source娩践,并選擇剛才配置好的mysql數(shù)據(jù)源輸入用戶密碼點(diǎn)擊connect返回到database reverse engineer options,點(diǎn)擊確定烹骨。
Step 6:此時(shí)彈出翻伺,database reverse engineer對(duì)話框。選擇要生成的表點(diǎn)擊ok即可
最重要的地方
PowerDesigner中逆向工程將數(shù)據(jù)庫(kù)中comment腳本賦值到PDM的name
執(zhí)行方法:Open PDM -- Tools -- Execute Commands -- Run Script
Vb script代碼
Option Explicit
ValidationMode = True
InteractiveMode = im_Batch
Dim mdl 'the current model
'get the current active model
Set mdl = ActiveModel
If (mdl Is Nothing) Then
MsgBox "There is no current Model"
ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then
MsgBox "The current model is not an Physical Data model."
Else
ProcessFolder mdl
End If
'This routine copy name into code for each table, each column and each view
'of the current folder
Private sub ProcessFolder(folder)
Dim Tab 'running table
for each Tab in folder.tables
if not tab.isShortcut then
if len(tab.comment) <> 0 then
tab.name = tab.comment
end if
On Error Resume Next
Dim col 'running column
for each col in tab.columns
if len(col.comment) <>0 then
col.name =col.comment
end if
On Error Resume Next
next
end if
next
end sub