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

76 lines
5.6 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="Batch updates" />
<meta name="abstract" content="Batch update support allows any updates to the database to be passed as a single transaction between the user program and the database. This procedure can significantly improve performance when many updates must be performed at once." />
<meta name="description" content="Batch update support allows any updates to the database to be passed as a single transaction between the user program and the database. This procedure can significantly improve performance when many updates must be performed at once." />
<meta name="DC.Relation" scheme="URI" content="jdbc.htm" />
<meta name="DC.Relation" scheme="URI" content="batchstm.htm" />
<meta name="DC.Relation" scheme="URI" content="batchpre.htm" />
<meta name="DC.Relation" scheme="URI" content="batchexc.htm" />
<meta name="DC.Relation" scheme="URI" content="batchblo.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="batchupd" />
<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>Batch updates</title>
</head>
<body id="batchupd"><a name="batchupd"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Batch updates</h1>
<div><p>Batch update support allows any updates to the database to be passed
as a single transaction between the user program and the database. This procedure
can significantly improve performance when many updates must be performed
at once. </p>
<p>For example, if a large company requires its newly hired employees to start
work on a Monday, this requirement makes it necessary to process many updates
(in this case, insertions) to the employee database at one time. Creating
a batch of updates and submitting them to the database as one unit can save
you processing time. </p>
<p>There are two types of batch updates:</p>
<ul><li>Batch updates that use Statement objects.</li>
<li>Batch updates that use PreparedStatement objects.</li>
</ul>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="batchstm.htm">Statement batch update</a></strong><br />
To perform a Statement batch update, you must turn off auto-commit.
In Java™ Database
Connectivity (JDBC), auto-commit is on by default. Auto-commit means any updates
to the database are committed after each SQL statement is processed. If you
want to treat a group of statements being handed to the database as one functional
group, you do not want the database committing each statement individually.
If you do not turn off auto-commit and a statement in the middle of the batch
fails, you cannot roll back the entire batch and try it again because half
of the statements have been made final. Further, the additional work of committing
each statement in a batch creates a lot of overhead.</li>
<li class="ulchildlink"><strong><a href="batchpre.htm">PreparedStatement batch update</a></strong><br />
A preparedStatement batch is similar to the Statement batch; however, a preparedStatement batch always works off the same prepared statement, and you only change the parameters to that statement.</li>
<li class="ulchildlink"><strong><a href="batchexc.htm">BatchUpdateException</a></strong><br />
An important consideration of batch updates is what action to take when a call to the executeBatch method fails. In this case, a new type of exception, called BatchUpdateException, is thrown. The BatchUpdateException is a subclass of SQLException and it allows you to call all the same methods you have always called to receive the message, the SQLState, and vendor code.</li>
<li class="ulchildlink"><strong><a href="batchblo.htm">Blocked insert support</a></strong><br />
You can use a blocked insert is an iSeries™ operation to insert several rows
into a database table at a time.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="jdbc.htm" title="The IBM Developer Kit for Java JDBC driver, also known as the &#34;native&#34; driver, provides programmatic access to iSeries database files. Using the Java Database Connectivity (JDBC) API, applications written in the Java language can access JDBC database functions with embedded Structured Query Language (SQL), run SQL statements, retrieve results, and propagate changes back to the database. The JDBC API can also be used to interact with multiple data sources in a distributed, heterogeneous environment.">Access your iSeries database with the IBM Developer Kit for Java JDBC driver</a></div>
</div>
</div>
</body>
</html>