1. 程式人生 > >PowerDesigner 連線MySQL資料庫詳細步驟

PowerDesigner 連線MySQL資料庫詳細步驟

 

需要的mysql odbc 連線軟體: 
mysql-connector-odbc-5.3.6-win32.msi; 
mysql-connector-odbc-5.3.6-winx64.msi;

在剛開始使用PowerDesigner 16連線MySQL資料庫的時候。經常會報一些錯誤,因為時間太久了,當時也忘了截圖,具體的錯誤忘記了,當初不知道怎麼解決,最後才發現是少安裝了幾個軟體,如果你也遇到了同樣的問題,可以先去自己的電腦裡面看看,是否少了以下截圖中的某個軟體,我這個人比較懶,按了好幾個重複的軟體也不打算解除安裝; 
這裡寫圖片描述

第一步:開啟PD軟體;

第二步:建立新的Model

這裡寫圖片描述

第三步:建立PDM檢視(選擇自己要連線的資料庫)

這裡寫圖片描述

第四步:連線資料來源:

這裡寫圖片描述 
這裡寫圖片描述 
這裡寫圖片描述 
這裡寫圖片描述 
這裡寫圖片描述 
這裡寫圖片描述 
這裡寫圖片描述 
這裡寫圖片描述

第五步:一路確定,並選擇你剛才所建立的資料來源

這裡寫圖片描述 
這裡寫圖片描述

第六步:很重要:

這裡寫圖片描述 
這裡寫圖片描述 
這裡寫圖片描述

第七步:等待生成:

這裡寫圖片描述

第八步:因為檔案中的name是英文,沒有引入註釋,再這裡我們需要進行一步操作,把name替換成中文註釋

這裡寫圖片描述 
這裡寫圖片描述

第九步:效果圖

這裡寫圖片描述

備註:

將Comment中的字元COPY至Name中的程式碼:

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

Private sub ProcessFolder(folder) 
On Error Resume Next 
Dim Tab ‘running table 
for each Tab in folder.tables 
if not tab.isShortcut then 
tab.name = tab.comment 
Dim col ’ running column 
for each col in tab.columns 
if col.comment=”” then 
else 
col.name= col.comment 
end if 
next 
end if 
next

 
  1. Dim view 'running view

  2. for each view in folder.Views

  3. if not view.isShortcut then

  4. view.name = view.comment

  5. end if

  6. next

  7.  
  8. ' go into the sub-packages

  9. Dim f ' running folder

  10. For Each f In folder.Packages

  11. if not f.IsShortcut then

  12. ProcessFolder f

  13. end if

  14. Next

end sub

將Name中的字元COPY至Comment中

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 comment 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 
tab.comment = tab.name 
Dim col ’ running column 
for each col in tab.columns 
col.comment= col.name 
next 
end if 
next

 
  1. Dim view 'running view

  2. for each view in folder.Views

  3. if not view.isShortcut then

  4. view.comment = view.name

  5. end if

  6. next

  7.  
  8. ' go into the sub-packages

  9. Dim f ' running folder

  10. For Each f In folder.Packages

  11. if not f.IsShortcut then

  12. ProcessFolder f

  13. end if

  14. Next

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

end sub