Network Deployment (Distributed operating systems), v8.0 > Reference > Command-line utilities


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.

The command syntax is as follows:

(AIX) (Solaris)

wsschema.sh [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:


Usage

The wsschema tool is used to obtain an XML file that describes the schema of your database.

To generate an XML schema file:

Messages and errors are logged to the admin 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:

(AIX) (Solaris)

$ wsschema.sh 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:

(AIX) (Solaris)

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

Write an SQL script that recreates the current database:

(AIX) (Solaris)

$ wsschema.sh -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:

(AIX) (Solaris)

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

Drop the current database:

(AIX) (Solaris)

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

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

(AIX) (Solaris)

$ wsschema.sh -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.


Related


Troubleshoot JPA applications

+

Search Tips   |   Advanced Search