ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahh_5.4.0.1/jdbclob.htm

104 lines
7.0 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="reference" />
<meta name="DC.Title" content="AS400JDBCClob class" />
<meta name="abstract" content="You can use a AS400JDBCClob object to access character large objects (CLOBs), such as large documents." />
<meta name="description" content="You can use a AS400JDBCClob object to access character large objects (CLOBs), such as large documents." />
<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="jdbclob" />
<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>AS400JDBCClob class</title>
</head>
<body id="jdbclob"><a name="jdbclob"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">AS400JDBCClob class</h1>
<div><p>You can use a AS400JDBCClob object to access character
large objects (CLOBs), such as large documents.</p>
<div class="section"><p> <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html">AS400JDBCClob</a> </p>
<p>The key difference between the AS400JDBCClob
class and the AS400JDBCClobLocator class is where the blob is stored. With
the AS400JDBCClob class, the clob is stored in the database, which inflates
the size of the database file. The AS400JDBCClobLocator class stores a locator
(think of it as a pointer) in the database file that points to where the
clob is located.</p>
<p>With the AS400JDBCClob class, the lob threshold property
can be used. This property specifies the maximum large object (LOB) size (in
kilobytes) that can be retrieved as part of a result set. LOBs that are larger
than this threshold are retrieved in pieces using extra communication to the
server. Larger LOB thresholds reduce the frequency of communication to the
server, but they download more LOB data, even if it is not used. Smaller lob
thresholds may increase frequency of communication to the server, but they
only download LOB data as it is needed. See <a href="jdbcproperties.htm#jdbcproperties">IBM Toolbox for Java JDBC properties</a> for
information on additional properties that are available.</p>
<p>Using the AS400JDBCClob
class, you can do the following:</p>
<ul><li>Return the entire clob as a <a href="javadoc/com/ibm/as400/access/AS400JDBCClobLocator.html#GETSUBSTRING(LONG, INT)">stream of ASCII characters</a></li>
<li>Return the <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#GETCHARACTERSTREAM()">contents</a> of the clob as a character stream</li>
<li>Return a <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#GETSUBSTRING(LONG, INT)">part of the contents</a> of the clob</li>
<li>Return the <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#LENGTH()">length</a> of the clob</li>
<li>Create a <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#SETCHARACTERSTREAM(LONG)">Unicode character stream</a> or an <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#SETASCIISTREAM(LONG)">ASCII character stream</a> to write to the clob</li>
<li><a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#SETSTRING(LONG, JAVA.LANG.STRING)">Write a String</a> to the clob</li>
<li><a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#TRUNCATE(LONG)">Truncate</a> the clob</li>
</ul>
</div>
<div class="section" id="jdbclob__clobexamples"><a name="jdbclob__clobexamples"><!-- --></a><h4 class="sectiontitle">Examples</h4><p>The following examples
show how to use the AS400JDBCClob class to read from a clob and update a clob:</p>
<p><strong>Example:
Using the AS400JDBCClob class to read from a clob</strong></p>
<pre> Clob clob = rs.getClob(1);
int length = clob.length();
String s = clob.getSubString(1, (int) length);</pre>
<p><strong>Example:
Using the AS400JDBCClob class to update a clob</strong></p>
<pre> ResultSet rs = statement.executeQuery ("SELECT CLOB FROM MYTABLE");
rs.absolute(4);
Clob clob = rs.getClob(1);
// Change the characters in the clob, starting at the third character
// of the clob
clob.setString (3, "Small");
// Update the clob in the result set, starting at the third character
// of the clob and truncating the clob at the end of the update string
// (the clob now has 7 characters).
rs.updateClob(1, clob);
// Update the database with the updated clob. This will change the
// clob in the database starting at the third character of the clob,
// and truncating at the end of the update string.
rs.updateRow();
rs.close();</pre>
</div>
<div class="section" id="jdbclob__jdbcclobloc"><a name="jdbclob__jdbcclobloc"><!-- --></a><h4 class="sectiontitle">AS400JDBCClobLocator class</h4><p>You
can use a <a href="javadoc/com/ibm/as400/access/AS400JDBCClobLocator.html#NAVBAR_TOP"> AS400JDBCClobLocator</a> object to access character large
objects (CLOBs).</p>
<p>Using the AS400JDBCClobLocator class, you can do the
following:</p>
<ul><li>Return the entire clob as a <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#GETASCIISTREAM()">stream of ASCII characters</a></li>
<li>Return the <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#GETCHARACTERSTREAM()">entire clob</a> as a character stream</li>
<li>Return a <a href="javadoc/com/ibm/as400/access/AS400JDBCClob.html#GETSUBSTRING(LONG, INT)">part of the contents</a> of the clob</li>
<li>Return the <a href="javadoc/com/ibm/as400/access/AS400JDBCClobLocator.html#LENGTH()">length</a> of the clob</li>
<li>Create a <a href="javadoc/com/ibm/as400/access/AS400JDBCClobLocator.html#SETCHARACTERSTREAM(LONG)">Unicode character stream</a> or an <a href="javadoc/com/ibm/as400/access/AS400JDBCClobLocator.html#SETASCIISTREAM(LONG)">ASCII character stream</a> to write to the clob</li>
<li><a href="javadoc/com/ibm/as400/access/AS400JDBCClobLocator.html#SETSTRING(LONG, JAVA.LANG.STRING)">Write a String</a> to the clob</li>
<li><a href="javadoc/com/ibm/as400/access/AS400JDBCClobLocator.html#TRUNCATE(LONG)">Truncate</a> the clob</li>
</ul>
</div>
</div>
</body>
</html>