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