A Java-based tool that generates definitions for server- and database-level objects in Adaptive Server. ddlgen supports Adaptive Server version 11.9.2 and later.
The command-line version of ddlgen is located in $SYBASE/sybcent32 (%SYBASE%\Sybase Central 3.2 in Windows NT).
ddlgen -Ulogin -Ppassword -Shost_name : port_number [-Tobject_type] [-Nobject_name] [-Ddatabase_name] [-Xextended_object_type] [-Ooutput_file] [-Eerror_file]
Or
ddlgen -v
specifies a login name, and is case-sensitive.
specifies your password.
specifies the host name or IP address of Adaptive Server, as well as its port number. Separate host_name and port_number with a colon, without spaces before or after it.
You must use the -S option because ddlgen does not connect to a default server, and does not support interface files.
specifies the type of object you are creating. If you do not use -T, ddlgen creates a DDL for the default database of login. Table 6-3 lists object types for -T.
Object type |
Description |
---|---|
C |
cache |
D |
default |
DB |
database |
DBD |
database device |
DPD |
dump device |
EC |
execution class |
EG |
engine group |
GRP |
group |
I |
index |
L |
login |
P |
stored procedure |
R |
rule |
RO |
role |
RS |
remote server |
SGM |
segment |
TR |
trigger |
U |
table |
UDD |
user-defined datatype |
USR |
user |
V |
view |
XP |
extended stored procedure |
specifies the fully qualified name of the object you are creating, such as -Ndb_name.owner.table.index. The -N option:
is required if you specify any object_type other than DB (database) in the -T parameter.
accepts wildcards with the use of %.
Use -N% to generate a DDL for all items of a specific object type on your server.
specifies the name of the database for the object you specify in the -N option. The default is the user’s default database.
differentiates user tables (OU) from proxy tables (OD) when you specify a table as your object type (-TU). If object_type (-T) is U (table) and -X is not specified, ddlgen generates DDL for both user tables and proxy tables. To generate a DDL only for:
user tables – use the OU extended object type with the -X option.
proxy tables – use the OD extended object type with the -X option.
specifies an output file for the generated DDL. If you do not specify -O, the DDL you create appears in a console window.
specifies a log file for recording errors. If you do not specify -E, the generated errors appear in a console window.
displays the version and copyright message of ddlgen and returns to the operating system.
Generates a DDL for a database called pubs2 running on a machine named HARBOR using port 1955:
ddlgen -Uroy -Proy123 -SHARBOR:1955 -TDB -Npubs2
If you do not specify a database_name, ddlgen generates a DDL for the default database of login:
ddlgen -Ulogin -Ppassword -Shost_name:portnumber
Generates a DDL for an index called au_lname for the table authors, in the database pubs2 owned by dbo, on a machine named HARBOR using port 1955:
ddlgen -Uroy -Proy123 -SHARBOR:1955 -TI -Nauthors.pubs2.au_lname -Dpubs2
Alternatively, because ddlgen allows you to use a fully qualified name in the -N flag, you can omit the -Ddatabase_name and include the database name in the -N option:
ddlgen -Ulogin -Ppassword -Shost_name:portnumber -TI -Ndatabasename.tableowner.tablename.indexname
If you use a fully qualified name, you may omit the -D option.
Generates a DDL for all logins on a machine named HARBOR using port 1955:
ddlgen -Uroy -Proy123 -SHARBOR:1955 -TL -N%
The password in the DDL generated for all logins is “password”.
Alternatively, you can specify an individual login by using -Nusername instead of -N%.
Generates a DDL for all rules associated with authors on a machine named HARBOR using port 1955:
DDLGen -Uroy -Proy123 -SHARBOR:1955 -TR -Nauthors.dbo.%
The % symbol tells DDLGen to create DDLs for all rules that exist on the server.
Generates a DDL for a user table called publishers:
ddlgen -Uroy -Proy123 -SHARBOR:1955 -TU -Ndbo.publishers -Dpubs2 -XOU
The -XOU option in this example specifies that the table you are referring to (-TU) is a user table (OU). To generate a DDL for a proxy table, which uses the value OD, use -XOD instead.
Generates a DDL for a user named Smith in the pubs2 database by using a fully qualified databasename.username format with the -N option:
ddlgen -Uroy -Proy123 -SHARBOR:1955 -TUSR -Npubs2.smith
Alternatively, you can use both the -N and -D options instead of using a fully qualified name in -N:
ddlgen -Ulogin -Ppassword -Shost_name:portnumber -TUSR -Nusername -Ddbname
ddlgen does not identify existing sequences within views, stored procedures or triggers. For this reason, you must first run ddlgen on those views, stored procedures and triggers that are independent, before running ddlgen on those with dependencies. For example, if view B depends on view A, you must first run ddlgen on view A, before running it on view B.
The default information for ddlgen is:
Option |
Parameter |
Required |
Default |
---|---|---|---|
-U |
username |
Yes |
None |
-P |
password |
Yes |
None |
-S |
host_name:port_number |
Yes |
None |
-T |
object_type See Table 6-3 for a list of valid object types |
No |
Default database of username |
-N |
object_name |
Yes, if object_type for -T is not DB (database) |
Default database name of username, if -Tobject_type is db or if -T is not specified |
-D |
database_name |
No |
Default database of username |
-X |
extended_object_type Options are OU for user tables, and OD for proxy tables |
No; use only when the object_type for -T is U (user table) |
None |
-O |
output_file_name |
No |
Standard out |
-E |
error_file_name |
No |
Standard out |
-V |
version_number of ddlgen |
No |
None |
To invoke ddlgen from a command line, you must install JRE 1.1.8 or higher, and have DDLGen.jar in your classpath.
At the command line, invoke ddlgen using the DDLGen.sh file (DDLGen.bat for Windows NT), included in your Adaptive Server installation. The ddlgen script that invokes ddlgen is com.sybase.ddlgen.DDLGenerator and, the main class in DDLGen.jar.
To start ddlgen in Sybase Central, the Adaptive Server plug-in:
Right-click on the object for which you want to generate a DDL.
Select Generate DDL.