Precompile SQL statements in a profile using the DB2 SQLJ profile customizer, db2profc

You can use the DB2® SQLJ Profile Customizer, db2profc, to make your Java™ application work more efficiently with your database.

The DB2 SQLJ Profile Customizer does the following:

To precompile the SQL statements in a profile, type in the following at the Qshell command prompt:

db2profc MyClass_SJProfile0.ser

Where MyClass_SJProfile0.ser is the name of the profile you want to precompile.

DB2 SQLJ Profile Customizer usage and syntax

db2profc[options] <SQLJ_profile_name>

Where SQLJ_profile_name is the name of the profile to be printed and options is the list of options you want.

The options available for db2profp are the following:

The following are the descriptions of these options:

-URL=<JDBC_URL>
Where JDBC_URL is the URL of the JDBC connection. The syntax for the URL is:
     "jdbc:db2:systemName"
For more information, see Access your iSeries™ database with the IBM® Developer Kit for Java JDBC driver.
-user=<username>
Where username is your username. The default value is the user ID of the current user that is signed on for local connection.
-password=<password>
Where password is your password. The default value is the password of the current user that is signed on for local connection.
-package=<library name/package name>
Where library name is the library where the package is placed, and package name is the name of the package to be generated. The default library name is QUSRSYS. The default package name is generated from the name of the profile. The maximum length for the package name is 10 characters. Because the SQLJ profile name is always longer than 10 characters, the default package name that is constructed is different from the profile name. The default package name is constructed by concatenating the first letters of the profile name with the profile key number. If the profile key number is greater than 10 characters long, then the last 10 characters of the profile key number is used for the default package name. For example, the following chart shows some profile names and their default package names:
Profile name Default package name
App_SJProfile0 App_SJPro0
App_SJProfile01234 App_S01234
App_SJProfile012345678 A012345678
App_SJProfile01234567891 1234567891
-commitctrl=<commitment_control>
Where commitment_control is the level of commitment control you want. Commitment control can have any one of the following character values:
Value Definition
C *CHG. Dirty reads, nonrepeatable reads and phantom reads are possible.
S *CS. Dirty reads are not possible, but non-repeatable reads and phantom reads are possible.
A *ALL. Dirty reads and nonrepeatable reads are not possible, but phantom reads are possible.
N *NONE. Dirty reads, nonrepeatable reads, and phantom reads are not possible. This is the default.
-datefmt=<date_format>
Where date_format is the type of date formatting you want. Date format can have any one of the following values:
Value Definition
USA IBM USA standard (mm.dd.yyyy,hh:mm a.m., hh:mm p.m.)
ISO International Standards Organization (yyyy-mm-dd, hh.mm.ss) This is the default.
EUR IBM European Standard (dd.mm.yyyy, hh.mm.ss)
JIS Japanese Industrial Standard Christian Era (yyyy-mm-dd, hh:mm:ss)
MDY Month/Day/Year (mm/d/yy)
DMY Day/Month/Year (dd/mm/yy)
YMD Year/Month/Day (yy/mm/dd)
JUL Julian (yy/ddd)
Date format is used when accessing date result columns. All output date fields are returned in the specified format. For input date strings, the specified value is used to determine whether the date is specified Inc valid format. The default value is ISO.
-datesep=<date_separator>
Where date_separator is the type of separator you want to use. Date separator is used when accessing date result columns. Date separator can be any of the following values:
Value Definition
/ A slash is used.
. A period is used.
, A comma is used.
- A dash is used. This is the default.
blank A space is used.
-timefmt=<time_format>
Where time_format is the format you want to use to display time fields. Time format is used when accessing time result columns. For input time strings, the specified value is used to determine whether the time is specified in a valid format. Time format can be any one of the following values:
Value Definition
USA IBM USA standard (mm.dd.yyyy,hh:mm a.m., hh:mm p.m.)
ISO International Standards Organization (yyyy-mm-dd, hh.mm.ss) This is the default.
EUR IBM European Standard (dd.mm.yyyy, hh.mm.ss)
JIS Japanese Industrial Standard Christian Era (yyyy-mm-dd, hh:mm:ss)
HMS Hour/Minute/Second (hh:mm:ss)
-timesep=<time_separator>
Where time_separator is the character you want to use to access your time result columns. Time separator can be any one of the following values:
Value Definition
: A colon is used.
. A period is used. This is the default.
, A comma is used.
blank A space is used.
-decimalpt=<decimal_point>
Where decimal_point is the decimal point you want to use. The decimal point is used for numeric constants in SQL statements. Decimal point can be any one of the following values:
Value Definition
. A period is used. This is the default.
, A comma is used.
-stmtCCSID=<CCSID>
Where CCSID is the coded character set identifier for the SQL statements that are prepared into the package. The value of the job during customization time is the default value.
-sorttbl=<library_name/sort_sequence_table_name>
Where library_name/sort_sequence_table_name is the location and table name of the sort sequence table you want to use. The sort sequence table is used for string comparisons in SQL statements. The library name and sort sequence table name each have limits of 10 characters. The default value is taken from the job during customization time.
-langID=<language_identifier>
Where language identifier is the language identifier you want to use. The default value for the language identifier is taken from the current job during customization time. The language identifier is used in conjunction with the sort sequence table.

For a more detailed information on any of these fields, see DB2 for iSeries SQL Programming Concepts, SC41-5611 Link to
PDF.

Related concepts
Structured Query Language for Java profiles
The structured query language for Java (SQLJ) translator (sqlj)
Print the contents of DB2 SQLJ profiles (db2profp and profp)
SQLJ profile auditor installer (profdb)
Embed SQL statements in your Java application
Related tasks
Convert a serialized profile instance to Java class format using the SQLJ profile conversion tool (profconv)
Compile and run SQLJ programs