powerdesigner建模如何連接數據庫


相信做數倉的同學來說,powerdesigne應該是比較常用的軟件,做好數倉就必須學習如何使用,那么我們將數據庫的表如何導入powerdesigne,對於新手來說,下面給大家講一下經驗首先講如何連接oracle數據庫。

創建模型oracle數據庫連接

找到數據庫連接設置

connection type選擇JDBC,DBMS type選擇Oracle,輸入鏈接信息

 

如果連接本地電腦:jdbc:oracle:thin:@127.0.0.1:1521:orcl

輸入完后,點擊右下角的“Test Connection...”按鈕,出現如圖(6)的頁面,看見彈出“Connection test successful”的彈出框,就可以了

 

 

下面是64位Windows 10系統運行32位的,需要重新設置,如下操作:

用搜索軟件,如初ODBC找到配置

找到數據源管理,點擊添加,找到oracle 32位,添加

 

TNS配置有名字就輸入,我本機沒有配置TNS,就空着。

配置好,輸入用戶名,密碼,就連接成功

 

打開PowerDesigner,在DataBase下拉菜單選擇點擊Connect,選擇剛才配好的ODBC就可以了!

 

 

 

 

表與表關聯關系:

點擊 紅框 按鈕 設置表主鍵關聯:一對多,或多對多

 

 

雙擊連接線,設置字段關聯,主鍵進行關聯

 

 

Powerdesigner將數據表的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

執行完:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM