96 lines
5.1 KiB
HTML
96 lines
5.1 KiB
HTML
<?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 xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="dc.language" scheme="rfc1766" 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. -->
|
|
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
|
|
<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="keywords" content="thread safety, threads, activation group,
|
|
SQL server mode" />
|
|
<title>Threads</title>
|
|
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
|
|
<link rel="stylesheet" type="text/css" href="ic.css" />
|
|
</head>
|
|
<body>
|
|
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
|
|
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
|
|
|
|
|
|
<a name="threads"></a>
|
|
<h3 id="threads"><a href="rbafzmst02.htm#ToC_51">Threads</a></h3><a id="idx129" name="idx129"></a>
|
|
<p>In i5/OS, an application process can also consist of one or more threads.
|
|
By default, a thread shares the same commitment definitions and locks as the
|
|
other threads in the job. Thus, each thread can operate on the same unit of
|
|
work so that when one thread commits or rolls back, it can commit or rollback
|
|
all changes performed by all threads. This type of processing is useful if
|
|
multiple threads are cooperating to perform a single task in parallel.</p><a id="idx130" name="idx130"></a><a id="idx131" name="idx131"></a>
|
|
<p>In other cases, it is useful for a thread to perform changes independent
|
|
from other threads in the job. In this case, the thread would not want to
|
|
share commitment definitions or lock with the other threads. Furthermore,
|
|
a job can use SQL server mode in order to take more fine grain control of
|
|
multiple database connections and transaction information. A typical multi-threaded
|
|
job may require this control. There are several ways to accomplish this type
|
|
of processing:</p>
|
|
<ul>
|
|
<li>Make sure the programs running in the thread use a separate activation
|
|
group (be careful not to use ACTGRP(*NEW)).</li>
|
|
<li>Make sure that the job is running in SQL server mode before issuing the
|
|
first SQL statement. SQL server mode can be activated for a job by using one
|
|
of the following mechanisms before data access occurs in the application:
|
|
<ul>
|
|
<li>Use the ODBC API, SQLSetEnvAttr() and set the SQL_ATTR_SERVER_MODE attribute
|
|
to SQL_TRUE before doing any data access.</li>
|
|
<li>Use the Change Job API, QWTCHGJB(), and set the 'Server mode for Structured
|
|
Query Language' key before doing any data access.</li>
|
|
<li>Use JAVA to access the database via JDBC. JDBC automatically uses server
|
|
mode to preserve required semantics of JDBC.</li></ul></li></ul><p class="indatacontent">When SQL server mode is established, all SQL statements are passed to
|
|
an independent server job that will handle the requests. Server mode behavior
|
|
for SQL behavior includes:</p>
|
|
<ul>
|
|
<li>For embedded SQL, each thread in a job implicitly gets one and only one
|
|
connection to the database (and thus its own commitable transaction).</li>
|
|
<li>For ODBC/CLI, JDBC, OLE DB, and .NET, each connection represents
|
|
a stand-alone connection to the database and can be committed and used as
|
|
a separate entity.</li></ul><p class="indatacontent">For more information, see the <a href="../cli/rzadpkickoff.htm">SQL Call Level Interface
|
|
(ODBC)</a> book.</p>
|
|
<p>The following SQL support is not threadsafe:</p>
|
|
<ul>
|
|
<li>Remote access through DRDA®</li>
|
|
<li>ALTER PROCEDURE</li>
|
|
<li>ALTER SEQUENCE</li>
|
|
<li>ALTER TABLE</li>
|
|
<li>COMMENT</li>
|
|
<li>CREATE ALIAS</li>
|
|
<li>CREATE DISTINCT TYPE</li>
|
|
<li>CREATE FUNCTION</li>
|
|
<li>CREATE INDEX</li>
|
|
<li>CREATE PROCEDURE</li>
|
|
<li>CREATE SCHEMA</li>
|
|
<li>CREATE SEQUENCE</li>
|
|
<li>CREATE TABLE</li>
|
|
<li>CREATE TRIGGER</li>
|
|
<li>CREATE VIEW</li>
|
|
<li>DECLARE GLOBAL TEMPORARY TABLE</li>
|
|
<li>DROP</li>
|
|
<li>GRANT</li>
|
|
<li>LABEL</li>
|
|
<li>REFRESH TABLE</li>
|
|
<li>RENAME</li>
|
|
<li>REVOKE</li></ul><p class="indatacontent">For more information, see <a href="../rzahw/rzahwovepo.htm">Multithreaded applications</a> in the Programming topic of the iSeries Information Center.</p>
|
|
<hr /><br />
|
|
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstappproc.htm">Previous Page</a> | <a href="rbafzmstisol.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
|
|
<a href="rbafzmstindex.htm#index">Index</a> ]
|
|
|
|
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
|
|
</body>
|
|
</html>
|