[PowerDesigner] Detailed steps for PowerDesigner to connect to MySQL database

The first step is to open the PD software

The second step is to create a new Model

The third step is to create a PDM view and select the database you want to connect to

The fourth step is to connect to the data source

The fifth step all the way to determine and select the data source you just created

The sixth step is very important

The seventh step waits for generation

The eighth step is because the name in the file is in English and no comments are introduced. Here we need to perform a step to replace the name with a Chinese comment.

The ninth step renderings

COPY the characters in Comment to the code in Name

COPY the characters in Name to Comment

Required mysql odbc connection software: 
mysql-connector-odbc-5.3.6-win32.msi; 
mysql-connector-odbc-5.3.6-winx64.msi;

When I first started using PowerDesigner 16 to connect to the MySQL database. I often report some errors because it has been too long, and I forgot to take screenshots at the time. I forgot the specific errors. I didn’t know how to solve them. I finally found out that a few softwares were missing. If you also encounter the same problem, You can go to your computer to see if you are missing a certain software in the screenshot below. I am a lazy person, and I do not intend to uninstall it after pressing several repeated software; 
Write picture description here

The first step: open the PD software;

Step 2: Create a new Model

Write picture description here

Step 3: Create a PDM view (select the database you want to connect to)

Write picture description here

Step 4: Connect to the data source:

Write picture description here 
Write picture description here 
Write picture description here 
Write picture description here 
Write picture description here 
Write picture description here 
Write picture description here 
Write picture description here

Step 5: Confirm all the way and select the data source you just created

Write picture description here 
Write picture description here

Step 6: Very important:

Write picture description here 
Write picture description here 
Write picture description here

Step 7: Wait for generation:

Write picture description here

Step 8: Because the name in the file is in English, no comments are introduced. Here we need to perform a step to replace name with Chinese comments

Write picture description here 
Write picture description here

Step 9: renderings

Write picture description here

Remarks:

COPY the characters in Comment to the code in 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

Dim view 'running view

for each view in folder.Views

if not view.isShortcut then

view.name = view.comment

end if

next


' go into the sub-packages

Dim f ' running folder

For Each f In folder.Packages

if not f.IsShortcut then

ProcessFolder f

end if

Next

end sub

COPY the characters in Name to 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

Dim view 'running view

for each view in folder.Views

if not view.isShortcut then

view.comment = view.name

end if

next


' go into the sub-packages

Dim f ' running folder

For Each f In folder.Packages

if not f.IsShortcut then

ProcessFolder f

end if

Next

Guess you like

Origin blog.csdn.net/qq_44065303/article/details/110937018