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

82 lines
6.2 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="Create ResultSets" />
<meta name="abstract" content="To create a ResultSet object, you can use executeQuery methods, or other methods. This article describes options for creating ResultSets." />
<meta name="description" content="To create a ResultSet object, you can use executeQuery methods, or other methods. This article describes options for creating ResultSets." />
<meta name="DC.Relation" scheme="URI" content="rsltsets.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltchar.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltcurs.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltdata.htm" />
<meta name="DC.Relation" scheme="URI" content="rsltchng.htm" />
<meta name="DC.Relation" scheme="URI" content="resultex.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="rsltclse" />
<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>Create ResultSets</title>
</head>
<body id="rsltclse"><a name="rsltclse"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Create ResultSets</h1>
<div><p>To create a ResultSet object, you can use executeQuery methods,
or other methods. This article describes options for creating ResultSets.</p>
<p>These methods are from the <a href="statemnt.htm">Statement</a>, <a href="prepstat.htm">PreparedStatement</a>, or <a href="callable.htm">CallableStatement</a> interfaces.
There are, however, other available methods. For example, <a href="datameta.htm">DatabaseMetaData
methods</a> such as getColumns, getTables, getUDTs, getPrimaryKeys, and
so on, return ResultSets. It is also possible to have a single SQL statement
return multiple ResultSets for processing. You can also use the getResultSet
method to retrieve a ResultSet object after calling the execute method provided
by the Statement, PreparedStatement, or CallableStatement interfaces.</p>
<p>See <a href="callexample1.htm">Example: Create a procedure with multiple
ResultSets</a> for more information.</p>
<div class="section"><h4 class="sectiontitle">Close ResultSets</h4><p>While a ResultSet object is automatically
closed when the Statement object with which it is associated closes, it is
recommended that you close ResultSet objects when you are finished using them.
By doing so, you immediately free internal database resources that can increase
application throughput.</p>
<p>It is also important to close ResultSets generated
by DatabaseMetaData calls. Because you do not directly have access to the
Statement object that was used to create these ResultSets, you do not call
close on the Statement object directly. These objects are linked together
in such a way that the JDBC driver closes the internal Statement object when
you close the external ResultSet object. When these objects are not closed
manually, the system continues to work; however, it uses more resources than
is necessary.</p>
<div class="note"><span class="notetitle">Note:</span> The holdability characteristic of ResultSets can also
close ResultSets automatically on you behalf. Calling close multiple times
on a ResultSet object is allowed. </div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rsltsets.htm" title="The ResultSet interface provides access to the results generated by running queries. Conceptually, data of a ResultSet can be thought of as a table with a specific number of columns and a specific number of rows. By default, the table rows are retrieved in sequence. Within a row, column values can be accessed in any order.">ResultSets</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rsltchar.htm" title="This topic discusses ResultSet characteristics such ResultSet types, concurrency, ability to close the ResultSet by committing the connection object, and specification of ResultSet characteristics.">ResultSet characteristics</a></div>
<div><a href="rsltcurs.htm" title="The iSeries Java Database Connectivity (JDBC) drivers support scrollable ResultSets. With a scrollable ResultSet, you can process rows of data in any order using a number of cursor-positioning methods.">Cursor movement</a></div>
<div><a href="rsltdata.htm" title="The ResultSet object provides several methods for obtaining column data for a row. All are of the form get&lt;Type&gt;, where &lt;Type&gt; is a Java data type. Some examples of these methods include getInt, getLong, getString, getTimestamp, and getBlob. Nearly all of these methods take a single parameter that is either the column index within the ResultSet or the column name.">Retrieve ResultSet data</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="rsltchng.htm" title="With the iSeries JDBC drivers, you can change ResultSets by performing several tasks.">Change ResultSets</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="resultex.htm" title="This is an example of how to use the ResultSet interface.">Example: ResultSet interface for IBM Developer Kit for Java</a></div>
</div>
</div>
</body>
</html>