forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
166 lines
15 KiB
HTML
166 lines
15 KiB
HTML
<a name="EN-US_TOPIC_0000001233563255"></a><a name="EN-US_TOPIC_0000001233563255"></a>
|
|
|
|
<h1 class="topictitle1">java.sql.PreparedStatement</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001233563255__a1470001e830c4be7ac67934ffcd5f5a1">This section describes <strong id="EN-US_TOPIC_0000001233563255__b842352706153232">java.sql.PreparedStatement</strong>, the interface for preparing statements.</p>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001233563255__te1ab52f1243c473aba685652ce0b646d" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Support status for java.sql.PreparedStatement</caption><thead align="left"><tr id="EN-US_TOPIC_0000001233563255__rdc9872a87d41488a942be724e831b77b"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.2.4.1.1"><p id="EN-US_TOPIC_0000001233563255__af2777a5b4a3d497db0e6f1f4d40a0794">Method Name</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.2.4.1.2"><p id="EN-US_TOPIC_0000001233563255__ad048cf560daa405c958aab7c4dd2d19c">Return Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.2.4.1.3"><p id="EN-US_TOPIC_0000001233563255__afa44038d9bbd4551b69c292dc7c26d6b">Support JDBC 4</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001233563255__rfb377df02e124c53bf9e0a108eac6463"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__afb6cc588113e4413b85818627b18b790">clearParameters()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a2a900b32752a4e02ab3f8a23afefb808">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a21c193a8bbfc44fd81a3cb11fb613236">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r9f0107c7ad3143b7b39b155632ff0185"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a1c54a1bc84274ef0b413263b98e8156d">execute()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a8a8c2639b9ae4ba3b2a7563691c4764f"><span id="EN-US_TOPIC_0000001233563255__text4686181281313">boolean</span></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a2bb32560ca354dc2b6013d55669e7c4f">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__re38c870cd25a4c109bc38c7ea21b0455"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a065f4cf3f35145c8a6499cd76d9c778f">executeQuery()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a53cda1bbe2a84b27a3cf7616154295d3">ResultSet</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a65690154f80e4502a4132f5b9e56b155">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r62cf199ef3724be1a40f70a7f7748144"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a6c9d0b7726e84cf48d6765f1a0616ce4">excuteUpdate()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a44b16fbdd85f422ba79672cb922d5752">int</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a239099a6eb7043828995ce362fec2ddc">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__rb6dc92b9840e4d159cee577816b40e04"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__acee1face507541d2970d4225fe076382">getMetaData()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a39b08673f876430fa2f2d1f10d2e2275">ResultSetMetaData</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a5163c4a064924756befb3430a1c81028">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__rc850d678726041cd9f75fdc369201dde"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a19a5a3f7ad3e4822b7ed7bbeef752ac7">setBoolean(int parameterIndex, boolean x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__aa1fb79c59ce34b2bb6185c35171c657f">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__aac7f685a793c4336ad90d0c2eddfd3d4">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__rbb377e109aa74aecb67c9057e31afaa5"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__af84665ed24084aa0b75b722d42f1e419">setBigDecimal(int parameterIndex, BigDecimal x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a61624106a9bc456e867a78a58e776278">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__aa8be03a077ce4108afb321b5affa4e8a">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r3d3fccfce2c34295a8352c0b6c3dfbee"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a4caabe57d70048118ffc97ee042f1028">setByte(int parameterIndex, byte x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a9c0eb94801e94187912e61579915a9cb">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__ade43aa98cd4d4a20944edba9b0473f1a">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r424a1bb131b641e19f49b8d95340445d"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a52fa411b873c4f1683a328b18b67c523">setBytes(int parameterIndex, byte[] x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a635e5e1726b7411999b0682a536e6729">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a12138c4bd5ef441d8c04eb253434071d">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__rfae345857b584717a86fd10a024844e0"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__ac85f34926cb9437087dc4f75c1b3752e">setDate(int parameterIndex, Date x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a14b645ff134749cc829ccb1ae32dda6a">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a7e695d900f9540339c8650c21dd09e70">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r1ff37712409048fa9926bd97cde9a480"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__ac84f22ad51404385879ee3c23c2c35ff">setDouble(int parameterIndex, double x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a24a265299f8845c084c526c01e1f3972">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__aeec8687d2db1412d930c8d513e84ffff">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r075f0cf1efdf4731bbd5107975c5198f"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__aa914b44b3c3241bbbddf4451b5a9275c">setFloat(int parameterIndex, float x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a3511571a76b349e3bb5af77b565c2c73">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a2530b1a6b0ac4381bdfc3d15e6e57d2a">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r1e03d7ed64ff49c5be57b6125119db87"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a9b09c845f777467c99aabea0aff44739">setInt(int parameterIndex, int x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a4feef9089360413d84964d77ba9921a9">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__aab8f48fae8b04429bf96250f7946d675">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r664f95749ae044a08e22d884fd29adb3"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a05a0434be24d4d889cce954e96c1bfa5">setLong(int parameterIndex, long x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a449e5ab7ea4741e98f40461135a01386">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__aa0b49ce4599e45dd86d39b2dbc3de87d">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__ra37c5c139ad945e29a63a4e45063e88f"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__ade8f50b4169f4d1f908ee05a767c34db">setNString(int parameterIndex, String value)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__aca31dc22170e460b885f299e5cae8c3f">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a9f3800ad892c4c57860b09216a2fc885">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__rc4448d5ba71241bfaeb4bdaca767d1b6"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__a85a33ca7e9704ea5be6ed27deeb8a4d4">setShort(int parameterIndex, short x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a6c88aaef00cf4e2cbe720047ba370498">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__aee2366b48a2f4be393b42491e7e17c27">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__ree79b8dd3dd445a2b05f8851e645c579"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__ab58247c915f34b7d979b7865726da9a9">setString(int parameterIndex, String x)</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__aabaa0e0d30ef40ad8deec267eacae961">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a71489ec70cfa455a8fd9c18b1baa5a10">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__rf366f7119e7f4187a4c728fc57b51bf7"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__aff450d6d80144e83b3c011000b66d0af">addBatch()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__a6f79a8c412e54459a088c76d2c0d69ca">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a168fe7051f1b4e3892d5574cc3fd315c">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r323b55ae62dd4c46afcb98f10b4fca45"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__af7283e96226a4417a638a7310429dd9f">executeBatch()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__ab591c960158b45c5a08c7f1f1d16bf85">int[]</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a154a46e763474d009c5e7df819409d9f">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001233563255__r45069bc6d865498899cf85ca9b6f8f76"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001233563255__acef7e1776ee74fe6b6815a499f3a31fa">clearBatch()</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001233563255__aa6da913c90404534892b2a38284e6299">void</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001233563255__a38da6e9512934d4a8f16d58ffb2cdc4a">Yes</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="note" id="EN-US_TOPIC_0000001233563255__n2a9b3d72c09e46ca922def95cb3b4143"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001233563255__ub287b3b6cd7b453eaf0d883ab7e4d1c7"><li id="EN-US_TOPIC_0000001233563255__l0e8269c1d673467d97397282cb5164f9">Execute addBatch() and execute() only after running clearBatch().</li><li id="EN-US_TOPIC_0000001233563255__ld84b223550f146bdb10fd06c0f8f4c89">Batch is not cleared by calling executeBatch(). Clear batch by explicitly calling clearBatch().</li><li id="EN-US_TOPIC_0000001233563255__lbe242d79f63e4a5791fb724483aa5bba">After bounded variables of a batch are added, if you want to reuse these values (add a batch again), set*() is not necessary.</li><li id="EN-US_TOPIC_0000001233563255__l8471216726564bc08f463298f37c2b63">The following methods are inherited from java.sql.Statement: close, execute, executeQuery, executeUpdate, getConnection, getResultSet, getUpdateCount, isClosed, setMaxRows, and setFetchSize.</li></ul>
|
|
</div></div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_0102.html">JDBC Interface Reference</a></div>
|
|
</div>
|
|
</div>
|
|
|