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

80 lines
6.1 KiB
HTML
Raw 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="Statement types" />
<meta name="abstract" content="The Statement interface and its PreparedStatement and CallableStatement subclasses are used to process structured query language (SQL) commands against the database. SQL statements cause the generation of ResultSet objects." />
<meta name="description" content="The Statement interface and its PreparedStatement and CallableStatement subclasses are used to process structured query language (SQL) commands against the database. SQL statements cause the generation of ResultSet objects." />
<meta name="DC.Relation" scheme="URI" content="jdbc.htm" />
<meta name="DC.Relation" scheme="URI" content="statemnt.htm" />
<meta name="DC.Relation" scheme="URI" content="prepstat.htm" />
<meta name="DC.Relation" scheme="URI" content="callable.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="statetyp" />
<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>Statement types</title>
</head>
<body id="statetyp"><a name="statetyp"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Statement types</h1>
<div><p>The Statement interface and its PreparedStatement and CallableStatement
subclasses are used to process structured query language (SQL) commands against
the database. SQL statements cause the generation of ResultSet objects.</p>
<p>Subclasses of the Statement interface are created with a number of methods
on the Connection interface. A single Connection object can have many Statement
objects created under it simultaneously. In past releases, it was possible
to give exact numbers of Statement objects that could be created. It is impossible
to do so in this release because different types of Statement objects take
different numbers of "handles" within the database engine. Therefore, the
types of Statement objects you are using influence the number of statements
that can be active under a connection at a single time.</p>
<p>An application calls the Statement.close method to indicate that the application
has finished processing a statement. All Statement objects are closed when
the connection that created them is closed. However, you should not fully
rely on this behavior to close Statement objects. For example, if your application
changes so that a connection pool is used instead of explicitly closing the
connections, the application "leaks" statement handles because the connections
never close. Closing Statement objects as soon as they are no longer required
allows external database resources that the statement is using to be released
immediately.</p>
<p>The native JDBC driver attempts to detect statement leaks and handles them
on you behalf. However, relying on that support results in poorer performance.</p>
<p>Due to the inheritance hierarchy that CallableStatement extends
PreparedStatement which extends Statement, features of each interface are
available in the class that extend the interface. For example, features of
the Statement class are also supported in the PreparedStatement and CallableStatement
classes. The main exception is the executeQuery, executeUpdate, and execute
methods on the Statement class. These methods take in an SQL statement to
dynamically process and cause exceptions if you attempt to use them with PreparedStatement
or CallableStatement objects.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="statemnt.htm">Statements</a></strong><br />
A Statement object is used for processing a static SQL statement and obtaining the results produced by it. Only one ResultSet for each Statement object can be open at a time. All statement methods that process an SQL statement implicitly close a statement's current ResultSet if an open one exists.</li>
<li class="ulchildlink"><strong><a href="prepstat.htm">PreparedStatements</a></strong><br />
PreparedStatements extend the Statement interface and provide support for adding parameters to SQL statements.</li>
<li class="ulchildlink"><strong><a href="callable.htm">CallableStatements</a></strong><br />
The CallableStatement interface extends PreparedStatement and provides support for output and input/output parameters. The CallableStatement interface also has support for input parameters that is provided by the PreparedStatement interface.</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>