+

Search Tips   |   Advanced Search

wsschema command

The schema tool can be used to view the database schema in XML form or match an XML schema to an existing database.

The wsschema tool can reflect on the current database schema, optionally translating it into an XML representation for further manipulation. The schema tool can take an XML schema definition, calculate the differences between the XML and the existing database schema, and apply the necessary changes to make the databases correspond to the XML schema. The XML format used by the schema tool is abstract from the differences in SQL dialects used by different vendors. The tool also automatically adapts its SQL to meet foreign dependencies, thus the schema tool is useful as a general way to manipulate the schemas.


Syntax

The command syntax is as follows:

(UNIX) (ZOS)

wsschema.sh [parameters][arguments]
(iSeries)
wsschema [parameters][arguments]
(Windows)
wsschema.bat [parameters][arguments]

Issue the command from the bin subdirectory of the profile_root directory.


Parameters

The wsschema tool accepts the standard set of command-line arguments defined by the configuration framework along with the following:

The wsschema tool is used to obtain an XML file that describes the schema of our database. To generate an XML schema file:

Messages and errors are logged to the administrative console as specified by the configuration.


Examples

Add the necessary schema components to the database to match the given XML document without dropping any data:

(UNIX) (ZOS)

$ wsschema.sh targetSchema.xml
(iSeries)
$ wsschema targetSchema.xml
(Windows)
$ wsschema.bat targetSchema.xml

Repeat the same action as the previous example, this time not changing the database but instead writing any planned changes to a SQL script:

(UNIX) (ZOS)

wsschema.sh -f script.sql targetSchema.xml
(iSeries)
wsschema -f script.sql targetSchema.xml
(Windows)
wsschema.bat -f script.sql targetSchema.xml

Write an SQL script that recreates the current database:

(UNIX) (ZOS)

$ wsschema.sh -a createDB -f script.sql
(iSeries)
$ wsschema -a createDB -f script.sql
(Windows)
$ wsschema.bat -a createDB -f script.sql

Refresh the schema and delete all the contents of all the tables that OpenJPA knows about:

(UNIX) (ZOS)

$ wsschema.bat -a refresh,deleteTableContents
(iSeries)
$ wsschema -a refresh,deleteTableContents
(Windows)
$ wsschema.bat -a refresh,deleteTableContents

Drop the current database:

(UNIX) (ZOS)

$ wsschema.sh -a dropDB
(iSeries)
$ wsschema -a dropDB
(Windows)
$ wsschema.bat -a dropDB

Write an XML representation of the current schema to the file schema.xml:

(UNIX) (ZOS)

$ wsschema.sh -a reflect -f schema.xml
(iSeries)
$ wsschema -a reflect -f schema.xml
(Windows)
$ wsschema.bat -a reflect -f schema.xml


Additional information

For more information read the JDBC information in the Apache OpenJPA documentation.

  • Apache OpenJPA User's Guide