wsdbgen command

The command supports utilization of the pureQuery feature in Java™ Persistence API (JPA) applications.

This command has been renamed wsdbgen for Feature Pack for OSGi Applications and JPA 2.0 and later releases. The command is used in the same way as the wsdb2gen command. The command, wsdb2gen, which implies for DB2® only, works only for DB2 database in WebSphere® Application Server V7.0. In this release, the command can be used for DB2, Informix® and Oracle databases. Because of that, a synonym, wsdbgen command, is introduced.

The JPA commands (.bat on Windows or .sh on UNIX) are run from the profile_root/bin directory, rather than from the app_server_root/bin directory to make sure that you have the latest version of the commands for your release.

Syntax

The command syntax is as follows:

[Linux][AIX][z/OS][HP-UX][Solaris]
wsdbgen.sh [parameters]
[IBM i]
wsdbgen [parameters]
[Windows]
wsdbgen.bat [parameters]

Before running the command, your persistence.xml file must be in the META-INF directory and the META-INF directory must be in the class path.

Parameters

  • -help: This parameter displays the help information.
  • -pu: The name of the persistence unit defined in persistence.xml file.
  • -collection: The collection-id which is assigned to package names. The default is NULLID.
  • -url: The URL of the target database.

    This is used to validate the generated SQL. A URL must be specified either in the persistence.xml file or as a command option. If both are specified, the URL that is specified in the command option is used.

  • -user: The user ID.
  • -pw: The corresponding password to connect to target database.

    If this parameter is not specified, the value found in the persistence.xml file is used.

  • -package: If this parameter is specified, the -package parameter takes the string value package name and a single database package with the specified name is generated. If the -package parameter is not specified, then one package is generated for each entity class. The entity name is used as package name if the -package option is not specified. The name length limit is the database limit -1, for example: 128 - 1 = 127.

Usage

The persistence.xml file must be included in the application Java archive (JAR) file and is also used as input in the DB2 bind to create the DB2 package. The command requires a connection to a database to validate generated SQL. The database does not have to be the same as the run time database, but it should be at the same version and release level.

Ensure that the following JAR files are on the class path:
  • pdq.jar
  • pdqmgmt.jar
  • db2jcc.jar
  • db2jcc_licence_cu.jar
If the database URL specifies a DB2 for z/OS® database, then the following JAR file must also be on the class path: db2jcc_licence_cisuz.jar
Attention: Read more about the DB2 JAR level compliance for IBM® Optim™ PureQuery Runtime at the IBM Support website: System requirements for IBM Optim PureQuery Runtime for Linux®, UNIX, and Windows.
Attention: Read about the pureQuery StaticBinder utility in the Data Studio documentation.

Examples

DB2
[Linux][AIX][z/OS][HP-UX][Solaris]
wsdbgen.sh  -pu payroll -collection prod1 -url jdbc:db2://myhostname:50000/proddb  -user produser -pw secret 
[IBM i]
wsdbgen  -pu payroll -collection prod1 -url jdbc:db2://myhostname:50000/proddb  -user produser -pw secret 
[Windows]
wsdbgen.bat  -pu payroll -collection prod1 -url jdbc:db2:\\myhostname:50000\proddb  -user produser -pw secret 
Informix
[Linux][AIX][z/OS][HP-UX][Solaris]
wsdbgen.sh  -pu payroll -collection prod1 -url jdbc:ids://myhostname:9089/proddb  -user produser -pw secret 
[IBM i]
wsdbgen  -pu payroll -collection prod1 -url jdbc:ids://myhostname:9089/proddb  -user produser -pw secret 
[Windows]
wsdbgen.bat  -pu payroll -collection prod1 -url jdbc:ids:\\myhostname:9089\proddb  -user produser -pw secret