Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Invoking Power Designer from the command line

680 views
Skip to first unread message

ellenosis

unread,
May 10, 2005, 11:03:46 AM5/10/05
to
Is there a way to invoke the Power Designer tool from a
batch file and cause it generate a database script? This
way, we could incorporate the database generation into our
system build process.
Thanks!

Matt Creason

unread,
May 10, 2005, 2:34:06 PM5/10/05
to
This is currently not an available feature. But you could automate this
by using OLE automation to open a PDM, generate the database creation
script in a file and execute the file.

To open a PDM and generate the database creation script in a file using
VBScript, you could use something like this:
Dim PDApp
Set PDApp = CreateObject("PowerDesigner.Application.11.0")

Dim PDM
Set PDM = PDApp.OpenModel("c:\My Documents\MyModel.pdm",
omf_DontOpenView)

If Not (PDM Is Nothing) Then
' Write the create database batch file
Dim ForWriting, system, file, fileName
ForWriting = 2 ' Open a file for writing.
Set system = CreateObject("Scripting.FileSystemObject")
' Write the create database script
fileName = "d:\temp\CreateDatabase.sql"
Set file = system.OpenTextFile(fileName, ForWriting, true)
' Use the GetPreview function to get the database creation
script
file.Write PDM.GetPreview("SQL")
file.Close
End If

In this example, we use the model options saved the PDM.
To modify the options, you could also use VBScript to modify the package
option object.
You could adapt the VBScript to other language (VB, C++, Java, .NET).
--
Matt Creason
Sr. System Consultant
NA PowerDesigner Team

Matt Creason

unread,
May 12, 2005, 10:19:21 AM5/12/05
to
This feature will be available in the next major release of PowerDesigner
due out Q405. Otherwise see my last post for a current workaround.

Ellen

unread,
May 17, 2005, 8:39:21 AM5/17/05
to
Can you tell me what I need to add? I just get this message
in the generated file:
-- The preview is empty because of the setting.
-- Check the generation option.

Matt Creason

unread,
Jun 14, 2005, 8:01:17 PM6/14/05
to
You need to check the database generation options and make sure the objects
you want to build DDL for have been selected in that dialog.
0 new messages