+

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.

Developers may find that they need the wsschema tool for its powerful functions. The wsschema tool can reflect on the current database schema, optionally translating it into an XML representation for further manipulation. Also, 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:
[AIX] [HP-UX] [Linux] [Solaris]

wsschema.sh [parameters][arguments]

(Windows)

wsschema.bat [parameters][arguments]

Issue the command from the bin subdirectory of the app_install_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 a XML file that describes the schema of the database. To generate a XML schema file:

Messages and errors are logged to the 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] [HP-UX] [Linux] [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] [HP-UX] [Linux] [Solaris]

 wsschema.sh -f script.sql targetSchema.xml

(Windows)

 wsschema.bat -f script.sql targetSchema.xml

Write an SQL script that will recreate the current database: [AIX] [HP-UX] [Linux] [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] [HP-UX] [Linux] [Solaris]

$ wsschema.bat -a refresh,deleteTableContents

(Windows)

$ wsschema.bat -a refresh,deleteTableContents

Drop the current database: [AIX] [HP-UX] [Linux] [Solaris]

$ wsschema.sh -a dropDB

(Windows)

$ wsschema.bat -a dropDB

Write a XML representation of the current schema to the file schema.xml: [AIX] [HP-UX] [Linux] [Solaris]

$ wsschema.sh -a reflect -f schema.xml

(Windows)

$ wsschema.bat -a reflect -f schema.xml

 

Additional information

See, refer to chapter 4 JDBC, in the OpenJPA reference documentation.



 

Related


Troubleshooting Java Persistence API (JPA) applications

 

Related information


Apache OpenJPA User's Guide: schema tool