ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaha_5.4.0.1/sqljdbpc.htm

339 lines
19 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="concept" />
<meta name="DC.Title" content="Precompile SQL statements in a profile using the DB2 SQLJ profile customizer, db2profc" />
<meta name="abstract" content="You can use the DB2 SQLJ Profile Customizer, db2profc, to make your Java application work more efficiently with your database." />
<meta name="description" content="You can use the DB2 SQLJ Profile Customizer, db2profc, to make your Java application work more efficiently with your database." />
<meta name="DC.Relation" scheme="URI" content="sqljintr.htm" />
<meta name="DC.Relation" scheme="URI" content="sqljprof.htm" />
<meta name="DC.Relation" scheme="URI" content="sqlj.htm" />
<meta name="DC.Relation" scheme="URI" content="sqljdbpp.htm" />
<meta name="DC.Relation" scheme="URI" content="sqljpdb.htm" />
<meta name="DC.Relation" scheme="URI" content="sqljpc.htm" />
<meta name="DC.Relation" scheme="URI" content="sqljembd.htm" />
<meta name="DC.Relation" scheme="URI" content="sqljcr.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="sqljdbpc" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Precompile SQL statements in a profile using the DB2 SQLJ profile
customizer, db2profc</title>
</head>
<body id="sqljdbpc"><a name="sqljdbpc"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Precompile SQL statements in a profile using the DB2 SQLJ profile
customizer, db2profc</h1>
<div><p>You can use the DB2<sup>®</sup> SQLJ Profile Customizer, db2profc, to make your Java™ application
work more efficiently with your database.</p>
<p>The DB2 SQLJ
Profile Customizer does the following:</p>
<ul><li>Precompiles the SQL statements that are stored in a profile and generates
a package in the DB2 database.</li>
<li>Customizes the SQLJ profile by replacing the SQL statements with references
to the associated statement in the package that was created.</li>
</ul>
<p>To precompile the SQL statements in a profile, type in the following at
the Qshell command prompt:</p>
<blockquote><pre>db2profc <em>MyClass_SJProfile0.ser</em></pre>
</blockquote>
<p>Where <em>MyClass_SJProfile0.ser</em> is the name of the profile you want
to precompile.</p>
<div class="section"><h4 class="sectiontitle">DB2 SQLJ
Profile Customizer usage and syntax</h4><p>db2profc[<em>options</em>] &lt;<em>SQLJ_profile_name</em>&gt;</p>
<p>Where <em>SQLJ_profile_name</em> is
the name of the profile to be printed and <em>options</em> is the list of options
you want.</p>
<p>The options available for db2profp are the following:</p>
<ul><li><samp class="codeph">-URL=&lt;<em>JDBC_URL</em>&gt;</samp></li>
<li><samp class="codeph">-user=&lt;<em>username</em>&gt;</samp></li>
<li><samp class="codeph">-password=&lt;<em>password</em>&gt;</samp></li>
<li><samp class="codeph">-package=&lt;<em>library_name/package_name</em>&gt;</samp></li>
<li><samp class="codeph">-commitctrl=&lt;<em>commitment_control</em>&gt;</samp></li>
<li><samp class="codeph">-datefmt=&lt;<em>date_format</em>&gt;</samp></li>
<li><samp class="codeph">-datesep=&lt;<em>date_separator</em>&gt;</samp></li>
<li><samp class="codeph">-timefmt=&lt;<em>time_format</em>&gt;</samp></li>
<li><samp class="codeph">-timesep=&lt;<em>time_separator</em>&gt;</samp></li>
<li><samp class="codeph">-decimalpt=&lt;<em>decimal_point</em>&gt;</samp></li>
<li><samp class="codeph">-stmtCCSID=&lt;<em>CCSID</em>&gt;</samp></li>
<li><samp class="codeph">-sorttbl=&lt;<em>library_name/sort_sequence_table_name</em>&gt;</samp></li>
<li><samp class="codeph">-langID=&lt;<em>language_identifier</em>&gt;</samp></li>
</ul>
<p>The following are the descriptions of these options:</p>
<dl><dt class="dlterm"><samp class="codeph">-URL=&lt;<em>JDBC_URL</em>&gt;</samp></dt>
<dd>Where <em>JDBC_URL</em> is the URL of the JDBC connection. The syntax for
the URL is: <pre> "jdbc:db2:systemName"</pre>
For more information,
see <a href="jdbc.htm">Access your iSeries™ database with the IBM<sup>®</sup> Developer
Kit for Java JDBC driver</a>.</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-user=&lt;<em>username</em>&gt;</samp></dt>
<dd>Where <em>username</em> is your username. The default value is the user
ID of the current user that is signed on for local connection.</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-password=&lt;<em>password</em>&gt;</samp></dt>
<dd>Where <em>password</em> is your password. The default value is the password
of the current user that is signed on for local connection.</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-package=&lt;<em>library name/package name</em>&gt;</samp></dt>
<dd>Where <em>library name</em> is the library where the package is placed,
and <em>package name</em> 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:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="90%" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e226">Profile name</th>
<th valign="top" id="d0e228">Default package name</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e226 ">App_SJProfile0</td>
<td valign="top" headers="d0e228 ">App_SJPro0</td>
</tr>
<tr><td valign="top" headers="d0e226 ">App_SJProfile01234</td>
<td valign="top" headers="d0e228 ">App_S01234</td>
</tr>
<tr><td valign="top" headers="d0e226 ">App_SJProfile012345678</td>
<td valign="top" headers="d0e228 ">A012345678</td>
</tr>
<tr><td valign="top" headers="d0e226 ">App_SJProfile01234567891</td>
<td valign="top" headers="d0e228 ">1234567891</td>
</tr>
</tbody>
</table>
</div>
</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-commitctrl=&lt;<em>commitment_control</em>&gt;</samp></dt>
<dd>Where <em>commitment_control</em> is the level of commitment control you
want. Commitment control can have any one of the following character values:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="90%" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e270">Value</th>
<th valign="top" id="d0e272">Definition</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e270 ">C</td>
<td valign="top" headers="d0e272 ">*CHG. Dirty reads, nonrepeatable reads and phantom reads are possible.</td>
</tr>
<tr><td valign="top" headers="d0e270 ">S</td>
<td valign="top" headers="d0e272 ">*CS. Dirty reads are not possible, but non-repeatable reads and phantom
reads are possible.</td>
</tr>
<tr><td valign="top" headers="d0e270 ">A</td>
<td valign="top" headers="d0e272 ">*ALL. Dirty reads and nonrepeatable reads are not possible, but phantom
reads are possible.</td>
</tr>
<tr><td valign="top" headers="d0e270 ">N</td>
<td valign="top" headers="d0e272 ">*NONE. Dirty reads, nonrepeatable reads, and phantom reads are not
possible. This is the default.</td>
</tr>
</tbody>
</table>
</div>
</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-datefmt=&lt;<em>date_format</em>&gt;</samp></dt>
<dd>Where <em>date_format</em> is the type of date formatting you want. Date
format can have any one of the following values:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="90%" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e314">Value</th>
<th valign="top" id="d0e316">Definition</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e314 ">USA</td>
<td valign="top" headers="d0e316 ">IBM USA
standard (mm.dd.yyyy,hh:mm a.m., hh:mm p.m.)</td>
</tr>
<tr><td valign="top" headers="d0e314 ">ISO</td>
<td valign="top" headers="d0e316 ">International Standards Organization (yyyy-mm-dd, hh.mm.ss) This is
the default.</td>
</tr>
<tr><td valign="top" headers="d0e314 ">EUR</td>
<td valign="top" headers="d0e316 ">IBM European
Standard (dd.mm.yyyy, hh.mm.ss)</td>
</tr>
<tr><td valign="top" headers="d0e314 ">JIS</td>
<td valign="top" headers="d0e316 ">Japanese Industrial Standard Christian Era (yyyy-mm-dd, hh:mm:ss)</td>
</tr>
<tr><td valign="top" headers="d0e314 ">MDY</td>
<td valign="top" headers="d0e316 ">Month/Day/Year (mm/d/yy)</td>
</tr>
<tr><td valign="top" headers="d0e314 ">DMY</td>
<td valign="top" headers="d0e316 ">Day/Month/Year (dd/mm/yy)</td>
</tr>
<tr><td valign="top" headers="d0e314 ">YMD</td>
<td valign="top" headers="d0e316 ">Year/Month/Day (yy/mm/dd)</td>
</tr>
<tr><td valign="top" headers="d0e314 ">JUL</td>
<td valign="top" headers="d0e316 ">Julian (yy/ddd)</td>
</tr>
</tbody>
</table>
</div>
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.</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-datesep=&lt;<em>date_separator</em>&gt;</samp></dt>
<dd>Where <em>date_separator</em> 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:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="90%" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e383">Value</th>
<th valign="top" id="d0e385">Definition</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e383 ">/</td>
<td valign="top" headers="d0e385 ">A slash is used.</td>
</tr>
<tr><td valign="top" headers="d0e383 ">.</td>
<td valign="top" headers="d0e385 ">A period is used.</td>
</tr>
<tr><td valign="top" headers="d0e383 ">,</td>
<td valign="top" headers="d0e385 ">A comma is used.</td>
</tr>
<tr><td valign="top" headers="d0e383 ">-</td>
<td valign="top" headers="d0e385 ">A dash is used. This is the default.</td>
</tr>
<tr><td valign="top" headers="d0e383 ">blank</td>
<td valign="top" headers="d0e385 ">A space is used.</td>
</tr>
</tbody>
</table>
</div>
</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-timefmt=&lt;<em>time_format</em>&gt;</samp></dt>
<dd>Where <em>time_format</em> 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:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="90%" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e432">Value</th>
<th valign="top" id="d0e434">Definition</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e432 ">USA</td>
<td valign="top" headers="d0e434 ">IBM USA
standard (mm.dd.yyyy,hh:mm a.m., hh:mm p.m.)</td>
</tr>
<tr><td valign="top" headers="d0e432 ">ISO</td>
<td valign="top" headers="d0e434 ">International Standards Organization (yyyy-mm-dd, hh.mm.ss) This is
the default.</td>
</tr>
<tr><td valign="top" headers="d0e432 ">EUR</td>
<td valign="top" headers="d0e434 ">IBM European
Standard (dd.mm.yyyy, hh.mm.ss)</td>
</tr>
<tr><td valign="top" headers="d0e432 ">JIS</td>
<td valign="top" headers="d0e434 ">Japanese Industrial Standard Christian Era (yyyy-mm-dd, hh:mm:ss)</td>
</tr>
<tr><td valign="top" headers="d0e432 ">HMS</td>
<td valign="top" headers="d0e434 ">Hour/Minute/Second (hh:mm:ss)</td>
</tr>
</tbody>
</table>
</div>
</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-timesep=&lt;<em>time_separator</em>&gt;</samp></dt>
<dd>Where <em>time_separator</em> is the character you want to use to access
your time result columns. Time separator can be any one of the following values:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="90%" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e486">Value</th>
<th valign="top" id="d0e488">Definition</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e486 ">:</td>
<td valign="top" headers="d0e488 ">A colon is used.</td>
</tr>
<tr><td valign="top" headers="d0e486 ">.</td>
<td valign="top" headers="d0e488 ">A period is used. This is the default.</td>
</tr>
<tr><td valign="top" headers="d0e486 ">,</td>
<td valign="top" headers="d0e488 ">A comma is used.</td>
</tr>
<tr><td valign="top" headers="d0e486 ">blank</td>
<td valign="top" headers="d0e488 ">A space is used.</td>
</tr>
</tbody>
</table>
</div>
</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-decimalpt=&lt;<em>decimal_point</em>&gt;</samp></dt>
<dd>Where <em>decimal_point</em> 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:
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" width="90%" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e531">Value</th>
<th valign="top" id="d0e533">Definition</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e531 ">.</td>
<td valign="top" headers="d0e533 ">A period is used. This is the default.</td>
</tr>
<tr><td valign="top" headers="d0e531 ">,</td>
<td valign="top" headers="d0e533 ">A comma is used.</td>
</tr>
</tbody>
</table>
</div>
</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-stmtCCSID=&lt;<em>CCSID</em>&gt;</samp></dt>
<dd>Where <em>CCSID</em> 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.</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-sorttbl=&lt;<em>library_name/sort_sequence_table_name</em>&gt;</samp></dt>
<dd>Where <em>library_name/sort_sequence_table_name</em> 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.</dd>
</dl>
<dl><dt class="dlterm"><samp class="codeph">-langID=&lt;<em>language_identifier</em>&gt;</samp></dt>
<dd>Where <em>language identifier</em> 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.</dd>
</dl>
<p>For a more detailed information on any of these fields,
see <a href="../sqlp/rbafymst.pdf" target="_blank">DB2 for iSeries SQL
Programming Concepts, SC41-5611</a> <img src="wbpdf.gif" alt="Link to&#xA;PDF" />.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="sqljintr.htm" title="DB2 Structured Query Language for Java (SQLJ) support is based on the SQLJ ANSI standard. The DB2 SQLJ support is contained in the IBM Developer Kit for Java. DB2 SQLJ support allows you to create, build, and run embedded SQL for Java applications.">Access databases using IBM Developer Kit for Java DB2 SQLJ support</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="sqljprof.htm" title="Profiles are generated by the SQLJ Translator, sqlj, when you translate the SQLJ source file. Profiles are serialized binary files. That is why these files have a .ser extension. These files contain the SQL statements from the associated SQLJ source file.">Structured Query Language for Java profiles</a></div>
<div><a href="sqlj.htm" title="The SQLJ translator, sqlj, generates a serialized profile containing information about the SQL operations found in the SQLJ program. The SQLJ translator uses the /QIBM/ProdData/Java400/ext/translator.zip file.">The structured query language for Java (SQLJ) translator (sqlj)</a></div>
<div><a href="sqljdbpp.htm" title="The DB2 SQLJ Profile Printer, db2profp, prints the contents of a DB2 customized profile in plain text. The Profile Printer, profp, prints the contents of profiles generated by the SQLJ translator in plain text.">Print the contents of DB2 SQLJ profiles (db2profp and profp)</a></div>
<div><a href="sqljpdb.htm" title="The SQLJ profile auditor installer (profdb) installs and uninstalls debugging class-auditors. The debugging class-auditors are installed into an existing set of binary profiles. Once the debugging class-auditors are installed, all RTStatement and RTResultSet calls made during application run time are logged. They can be logged to a file or standard output. The logs can then be inspected to verify the behavior and trace errors of the application. Note that only the calls made to the underlying RTStatement and RTResultSetcall interface at run time are audited.">SQLJ profile auditor installer (profdb)</a></div>
<div><a href="sqljembd.htm" title="Static SQL statements in SQLJ are in SQLJ clauses. SQLJ clauses begin with #sql and end with a semicolon (;) character.">Embed SQL statements in your Java application</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="sqljpc.htm" title="The SQLJ profile conversion tool (profconv) converts a serialized profile instance to Java class format. The profconv tool is needed because some browsers do not support loading a serialized object from a resource file that is associated with an applet. Run the profconv utility to perform the conversion.">Convert a serialized profile instance to Java class format using the SQLJ profile conversion tool (profconv)</a></div>
<div><a href="sqljcr.htm" title="If you Java program has embedded SQLJ statements, you need to follow a special procedure to compile and run it.">Compile and run SQLJ programs</a></div>
</div>
</div>
</body>
</html>