Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.sql/share/classes/java/sql/CallableStatement.java
41153 views
1
/*
2
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package java.sql;
27
28
import java.math.BigDecimal;
29
import java.util.Calendar;
30
import java.io.Reader;
31
import java.io.InputStream;
32
33
/**
34
* The interface used to execute SQL stored procedures. The JDBC API
35
* provides a stored procedure SQL escape syntax that allows stored procedures
36
* to be called in a standard way for all RDBMSs. This escape syntax has one
37
* form that includes a result parameter and one that does not. If used, the result
38
* parameter must be registered as an OUT parameter. The other parameters
39
* can be used for input, output or both. Parameters are referred to
40
* sequentially, by number, with the first parameter being 1.
41
* <PRE>
42
* {?= call &lt;procedure-name&gt;[(&lt;arg1&gt;,&lt;arg2&gt;, ...)]}
43
* {call &lt;procedure-name&gt;[(&lt;arg1&gt;,&lt;arg2&gt;, ...)]}
44
* </PRE>
45
* <P>
46
* IN parameter values are set using the {@code set} methods inherited from
47
* {@link PreparedStatement}. The type of all OUT parameters must be
48
* registered prior to executing the stored procedure; their values
49
* are retrieved after execution via the {@code get} methods provided here.
50
* <P>
51
* A {@code CallableStatement} can return one {@link ResultSet} object or
52
* multiple {@code ResultSet} objects. Multiple
53
* {@code ResultSet} objects are handled using operations
54
* inherited from {@link Statement}.
55
* <P>
56
* For maximum portability, a call's {@code ResultSet} objects and
57
* update counts should be processed prior to getting the values of output
58
* parameters.
59
*
60
*
61
* @see Connection#prepareCall
62
* @see ResultSet
63
* @since 1.1
64
*/
65
66
public interface CallableStatement extends PreparedStatement {
67
68
/**
69
* Registers the OUT parameter in ordinal position
70
* {@code parameterIndex} to the JDBC type
71
* {@code sqlType}. All OUT parameters must be registered
72
* before a stored procedure is executed.
73
* <p>
74
* The JDBC type specified by {@code sqlType} for an OUT
75
* parameter determines the Java type that must be used
76
* in the {@code get} method to read the value of that parameter.
77
* <p>
78
* If the JDBC type expected to be returned to this output parameter
79
* is specific to this particular database, {@code sqlType}
80
* should be {@code java.sql.Types.OTHER}. The method
81
* {@link #getObject} retrieves the value.
82
*
83
* @param parameterIndex the first parameter is 1, the second is 2,
84
* and so on
85
* @param sqlType the JDBC type code defined by {@code java.sql.Types}.
86
* If the parameter is of JDBC type {@code NUMERIC}
87
* or {@code DECIMAL}, the version of
88
* {@code registerOutParameter} that accepts a scale value
89
* should be used.
90
*
91
* @throws SQLException if the parameterIndex is not valid;
92
* if a database access error occurs or
93
* this method is called on a closed {@code CallableStatement}
94
* @throws SQLFeatureNotSupportedException if {@code sqlType} is
95
* a {@code ARRAY}, {@code BLOB}, {@code CLOB},
96
* {@code DATALINK}, {@code JAVA_OBJECT}, {@code NCHAR},
97
* {@code NCLOB}, {@code NVARCHAR}, {@code LONGNVARCHAR},
98
* {@code REF}, {@code ROWID}, {@code SQLXML}
99
* or {@code STRUCT} data type and the JDBC driver does not support
100
* this data type
101
* @see Types
102
*/
103
void registerOutParameter(int parameterIndex, int sqlType)
104
throws SQLException;
105
106
/**
107
* Registers the parameter in ordinal position
108
* {@code parameterIndex} to be of JDBC type
109
* {@code sqlType}. All OUT parameters must be registered
110
* before a stored procedure is executed.
111
* <p>
112
* The JDBC type specified by {@code sqlType} for an OUT
113
* parameter determines the Java type that must be used
114
* in the {@code get} method to read the value of that parameter.
115
* <p>
116
* This version of {@code registerOutParameter} should be
117
* used when the parameter is of JDBC type {@code NUMERIC}
118
* or {@code DECIMAL}.
119
*
120
* @param parameterIndex the first parameter is 1, the second is 2,
121
* and so on
122
* @param sqlType the SQL type code defined by {@code java.sql.Types}.
123
* @param scale the desired number of digits to the right of the
124
* decimal point. It must be greater than or equal to zero.
125
* @throws SQLException if the parameterIndex is not valid;
126
* if a database access error occurs or
127
* this method is called on a closed {@code CallableStatement}
128
* @throws SQLFeatureNotSupportedException if {@code sqlType} is
129
* a {@code ARRAY}, {@code BLOB}, {@code CLOB},
130
* {@code DATALINK}, {@code JAVA_OBJECT}, {@code NCHAR},
131
* {@code NCLOB}, {@code NVARCHAR}, {@code LONGNVARCHAR},
132
* {@code REF}, {@code ROWID}, {@code SQLXML}
133
* or {@code STRUCT} data type and the JDBC driver does not support
134
* this data type
135
* @see Types
136
*/
137
void registerOutParameter(int parameterIndex, int sqlType, int scale)
138
throws SQLException;
139
140
/**
141
* Retrieves whether the last OUT parameter read had the value of
142
* SQL {@code NULL}. Note that this method should be called only after
143
* calling a getter method; otherwise, there is no value to use in
144
* determining whether it is {@code null} or not.
145
*
146
* @return {@code true} if the last parameter read was SQL
147
* {@code NULL}; {@code false} otherwise
148
* @throws SQLException if a database access error occurs or
149
* this method is called on a closed {@code CallableStatement}
150
*/
151
boolean wasNull() throws SQLException;
152
153
/**
154
* Retrieves the value of the designated JDBC {@code CHAR},
155
* {@code VARCHAR}, or {@code LONGVARCHAR} parameter as a
156
* {@code String} in the Java programming language.
157
* <p>
158
* For the fixed-length type JDBC {@code CHAR},
159
* the {@code String} object
160
* returned has exactly the same value the SQL
161
* {@code CHAR} value had in the
162
* database, including any padding added by the database.
163
*
164
* @param parameterIndex the first parameter is 1, the second is 2,
165
* and so on
166
* @return the parameter value. If the value is SQL {@code NULL},
167
* the result
168
* is {@code null}.
169
* @throws SQLException if the parameterIndex is not valid;
170
* if a database access error occurs or
171
* this method is called on a closed {@code CallableStatement}
172
* @see #setString
173
*/
174
String getString(int parameterIndex) throws SQLException;
175
176
/**
177
* Retrieves the value of the designated JDBC {@code BIT}
178
* or {@code BOOLEAN} parameter as a
179
* {@code boolean} in the Java programming language.
180
*
181
* @param parameterIndex the first parameter is 1, the second is 2,
182
* and so on
183
* @return the parameter value. If the value is SQL {@code NULL},
184
* the result is {@code false}.
185
* @throws SQLException if the parameterIndex is not valid;
186
* if a database access error occurs or
187
* this method is called on a closed {@code CallableStatement}
188
* @see #setBoolean
189
*/
190
boolean getBoolean(int parameterIndex) throws SQLException;
191
192
/**
193
* Retrieves the value of the designated JDBC {@code TINYINT} parameter
194
* as a {@code byte} in the Java programming language.
195
*
196
* @param parameterIndex the first parameter is 1, the second is 2,
197
* and so on
198
* @return the parameter value. If the value is SQL {@code NULL}, the result
199
* is {@code 0}.
200
* @throws SQLException if the parameterIndex is not valid;
201
* if a database access error occurs or
202
* this method is called on a closed {@code CallableStatement}
203
* @see #setByte
204
*/
205
byte getByte(int parameterIndex) throws SQLException;
206
207
/**
208
* Retrieves the value of the designated JDBC {@code SMALLINT} parameter
209
* as a {@code short} in the Java programming language.
210
*
211
* @param parameterIndex the first parameter is 1, the second is 2,
212
* and so on
213
* @return the parameter value. If the value is SQL {@code NULL}, the result
214
* is {@code 0}.
215
* @throws SQLException if the parameterIndex is not valid;
216
* if a database access error occurs or
217
* this method is called on a closed {@code CallableStatement}
218
* @see #setShort
219
*/
220
short getShort(int parameterIndex) throws SQLException;
221
222
/**
223
* Retrieves the value of the designated JDBC {@code INTEGER} parameter
224
* as an {@code int} in the Java programming language.
225
*
226
* @param parameterIndex the first parameter is 1, the second is 2,
227
* and so on
228
* @return the parameter value. If the value is SQL {@code NULL}, the result
229
* is {@code 0}.
230
* @throws SQLException if the parameterIndex is not valid;
231
* if a database access error occurs or
232
* this method is called on a closed {@code CallableStatement}
233
* @see #setInt
234
*/
235
int getInt(int parameterIndex) throws SQLException;
236
237
/**
238
* Retrieves the value of the designated JDBC {@code BIGINT} parameter
239
* as a {@code long} in the Java programming language.
240
*
241
* @param parameterIndex the first parameter is 1, the second is 2,
242
* and so on
243
* @return the parameter value. If the value is SQL {@code NULL}, the result
244
* is {@code 0}.
245
* @throws SQLException if the parameterIndex is not valid;
246
* if a database access error occurs or
247
* this method is called on a closed {@code CallableStatement}
248
* @see #setLong
249
*/
250
long getLong(int parameterIndex) throws SQLException;
251
252
/**
253
* Retrieves the value of the designated JDBC {@code FLOAT} parameter
254
* as a {@code float} in the Java programming language.
255
*
256
* @param parameterIndex the first parameter is 1, the second is 2,
257
* and so on
258
* @return the parameter value. If the value is SQL {@code NULL}, the result
259
* is {@code 0}.
260
* @throws SQLException if the parameterIndex is not valid;
261
* if a database access error occurs or
262
* this method is called on a closed {@code CallableStatement}
263
* @see #setFloat
264
*/
265
float getFloat(int parameterIndex) throws SQLException;
266
267
/**
268
* Retrieves the value of the designated JDBC {@code DOUBLE} parameter as a {@code double}
269
* in the Java programming language.
270
* @param parameterIndex the first parameter is 1, the second is 2,
271
* and so on
272
* @return the parameter value. If the value is SQL {@code NULL}, the result
273
* is {@code 0}.
274
* @throws SQLException if the parameterIndex is not valid;
275
* if a database access error occurs or
276
* this method is called on a closed {@code CallableStatement}
277
* @see #setDouble
278
*/
279
double getDouble(int parameterIndex) throws SQLException;
280
281
/**
282
* Retrieves the value of the designated JDBC {@code NUMERIC} parameter as a
283
* {@code java.math.BigDecimal} object with <i>scale</i> digits to
284
* the right of the decimal point.
285
* @param parameterIndex the first parameter is 1, the second is 2,
286
* and so on
287
* @param scale the number of digits to the right of the decimal point
288
* @return the parameter value. If the value is SQL {@code NULL}, the result
289
* is {@code null}.
290
* @throws SQLException if the parameterIndex is not valid;
291
* if a database access error occurs or
292
* this method is called on a closed {@code CallableStatement}
293
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
294
* this method
295
* @deprecated use {@code getBigDecimal(int parameterIndex)}
296
* or {@code getBigDecimal(String parameterName)}
297
* @see #setBigDecimal
298
*/
299
@Deprecated(since="1.2")
300
BigDecimal getBigDecimal(int parameterIndex, int scale)
301
throws SQLException;
302
303
/**
304
* Retrieves the value of the designated JDBC {@code BINARY} or
305
* {@code VARBINARY} parameter as an array of {@code byte}
306
* values in the Java programming language.
307
* @param parameterIndex the first parameter is 1, the second is 2,
308
* and so on
309
* @return the parameter value. If the value is SQL {@code NULL}, the result
310
* is {@code null}.
311
* @throws SQLException if the parameterIndex is not valid;
312
* if a database access error occurs or
313
* this method is called on a closed {@code CallableStatement}
314
* @see #setBytes
315
*/
316
byte[] getBytes(int parameterIndex) throws SQLException;
317
318
/**
319
* Retrieves the value of the designated JDBC {@code DATE} parameter as a
320
* {@code java.sql.Date} object.
321
* @param parameterIndex the first parameter is 1, the second is 2,
322
* and so on
323
* @return the parameter value. If the value is SQL {@code NULL}, the result
324
* is {@code null}.
325
* @throws SQLException if the parameterIndex is not valid;
326
* if a database access error occurs or
327
* this method is called on a closed {@code CallableStatement}
328
* @see #setDate
329
*/
330
java.sql.Date getDate(int parameterIndex) throws SQLException;
331
332
/**
333
* Retrieves the value of the designated JDBC {@code TIME} parameter as a
334
* {@code java.sql.Time} object.
335
*
336
* @param parameterIndex the first parameter is 1, the second is 2,
337
* and so on
338
* @return the parameter value. If the value is SQL {@code NULL}, the result
339
* is {@code null}.
340
* @throws SQLException if the parameterIndex is not valid;
341
* if a database access error occurs or
342
* this method is called on a closed {@code CallableStatement}
343
* @see #setTime
344
*/
345
java.sql.Time getTime(int parameterIndex) throws SQLException;
346
347
/**
348
* Retrieves the value of the designated JDBC {@code TIMESTAMP} parameter as a
349
* {@code java.sql.Timestamp} object.
350
*
351
* @param parameterIndex the first parameter is 1, the second is 2,
352
* and so on
353
* @return the parameter value. If the value is SQL {@code NULL}, the result
354
* is {@code null}.
355
* @throws SQLException if the parameterIndex is not valid;
356
* if a database access error occurs or
357
* this method is called on a closed {@code CallableStatement}
358
* @see #setTimestamp
359
*/
360
java.sql.Timestamp getTimestamp(int parameterIndex)
361
throws SQLException;
362
363
//----------------------------------------------------------------------
364
// Advanced features:
365
366
367
/**
368
* Retrieves the value of the designated parameter as an {@code Object}
369
* in the Java programming language. If the value is an SQL {@code NULL},
370
* the driver returns a Java {@code null}.
371
* <p>
372
* This method returns a Java object whose type corresponds to the JDBC
373
* type that was registered for this parameter using the method
374
* {@code registerOutParameter}. By registering the target JDBC
375
* type as {@code java.sql.Types.OTHER}, this method can be used
376
* to read database-specific abstract data types.
377
*
378
* @param parameterIndex the first parameter is 1, the second is 2,
379
* and so on
380
* @return A {@code java.lang.Object} holding the OUT parameter value
381
* @throws SQLException if the parameterIndex is not valid;
382
* if a database access error occurs or
383
* this method is called on a closed {@code CallableStatement}
384
* @see Types
385
* @see #setObject
386
*/
387
Object getObject(int parameterIndex) throws SQLException;
388
389
390
//--------------------------JDBC 2.0-----------------------------
391
392
/**
393
* Retrieves the value of the designated JDBC {@code NUMERIC} parameter as a
394
* {@code java.math.BigDecimal} object with as many digits to the
395
* right of the decimal point as the value contains.
396
* @param parameterIndex the first parameter is 1, the second is 2,
397
* and so on
398
* @return the parameter value in full precision. If the value is
399
* SQL {@code NULL}, the result is {@code null}.
400
* @throws SQLException if the parameterIndex is not valid;
401
* if a database access error occurs or
402
* this method is called on a closed {@code CallableStatement}
403
* @see #setBigDecimal
404
* @since 1.2
405
*/
406
BigDecimal getBigDecimal(int parameterIndex) throws SQLException;
407
408
/**
409
* Returns an object representing the value of OUT parameter
410
* {@code parameterIndex} and uses {@code map} for the custom
411
* mapping of the parameter value.
412
* <p>
413
* This method returns a Java object whose type corresponds to the
414
* JDBC type that was registered for this parameter using the method
415
* {@code registerOutParameter}. By registering the target
416
* JDBC type as {@code java.sql.Types.OTHER}, this method can
417
* be used to read database-specific abstract data types.
418
* @param parameterIndex the first parameter is 1, the second is 2, and so on
419
* @param map the mapping from SQL type names to Java classes
420
* @return a {@code java.lang.Object} holding the OUT parameter value
421
* @throws SQLException if the parameterIndex is not valid;
422
* if a database access error occurs or
423
* this method is called on a closed {@code CallableStatement}
424
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
425
* this method
426
* @see #setObject
427
* @since 1.2
428
*/
429
Object getObject(int parameterIndex, java.util.Map<String,Class<?>> map)
430
throws SQLException;
431
432
/**
433
* Retrieves the value of the designated JDBC {@code REF(<structured-type>)}
434
* parameter as a {@link java.sql.Ref} object in the Java programming language.
435
* @param parameterIndex the first parameter is 1, the second is 2,
436
* and so on
437
* @return the parameter value as a {@code Ref} object in the
438
* Java programming language. If the value was SQL {@code NULL}, the value
439
* {@code null} is returned.
440
* @throws SQLException if the parameterIndex is not valid;
441
* if a database access error occurs or
442
* this method is called on a closed {@code CallableStatement}
443
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
444
* this method
445
* @since 1.2
446
*/
447
Ref getRef (int parameterIndex) throws SQLException;
448
449
/**
450
* Retrieves the value of the designated JDBC {@code BLOB} parameter as a
451
* {@link java.sql.Blob} object in the Java programming language.
452
* @param parameterIndex the first parameter is 1, the second is 2, and so on
453
* @return the parameter value as a {@code Blob} object in the
454
* Java programming language. If the value was SQL {@code NULL}, the value
455
* {@code null} is returned.
456
* @throws SQLException if the parameterIndex is not valid;
457
* if a database access error occurs or
458
* this method is called on a closed {@code CallableStatement}
459
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
460
* this method
461
* @since 1.2
462
*/
463
Blob getBlob (int parameterIndex) throws SQLException;
464
465
/**
466
* Retrieves the value of the designated JDBC {@code CLOB} parameter as a
467
* {@code java.sql.Clob} object in the Java programming language.
468
* @param parameterIndex the first parameter is 1, the second is 2, and
469
* so on
470
* @return the parameter value as a {@code Clob} object in the
471
* Java programming language. If the value was SQL {@code NULL}, the
472
* value {@code null} is returned.
473
* @throws SQLException if the parameterIndex is not valid;
474
* if a database access error occurs or
475
* this method is called on a closed {@code CallableStatement}
476
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
477
* this method
478
* @since 1.2
479
*/
480
Clob getClob (int parameterIndex) throws SQLException;
481
482
/**
483
*
484
* Retrieves the value of the designated JDBC {@code ARRAY} parameter as an
485
* {@link java.sql.Array} object in the Java programming language.
486
* @param parameterIndex the first parameter is 1, the second is 2, and
487
* so on
488
* @return the parameter value as an {@code Array} object in
489
* the Java programming language. If the value was SQL {@code NULL}, the
490
* value {@code null} is returned.
491
* @throws SQLException if the parameterIndex is not valid;
492
* if a database access error occurs or
493
* this method is called on a closed {@code CallableStatement}
494
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
495
* this method
496
* @since 1.2
497
*/
498
Array getArray (int parameterIndex) throws SQLException;
499
500
/**
501
* Retrieves the value of the designated JDBC {@code DATE} parameter as a
502
* {@code java.sql.Date} object, using
503
* the given {@code Calendar} object
504
* to construct the date.
505
* With a {@code Calendar} object, the driver
506
* can calculate the date taking into account a custom timezone and locale.
507
* If no {@code Calendar} object is specified, the driver uses the
508
* default timezone and locale.
509
*
510
* @param parameterIndex the first parameter is 1, the second is 2,
511
* and so on
512
* @param cal the {@code Calendar} object the driver will use
513
* to construct the date
514
* @return the parameter value. If the value is SQL {@code NULL}, the result
515
* is {@code null}.
516
* @throws SQLException if the parameterIndex is not valid;
517
* if a database access error occurs or
518
* this method is called on a closed {@code CallableStatement}
519
* @see #setDate
520
* @since 1.2
521
*/
522
java.sql.Date getDate(int parameterIndex, Calendar cal)
523
throws SQLException;
524
525
/**
526
* Retrieves the value of the designated JDBC {@code TIME} parameter as a
527
* {@code java.sql.Time} object, using
528
* the given {@code Calendar} object
529
* to construct the time.
530
* With a {@code Calendar} object, the driver
531
* can calculate the time taking into account a custom timezone and locale.
532
* If no {@code Calendar} object is specified, the driver uses the
533
* default timezone and locale.
534
*
535
* @param parameterIndex the first parameter is 1, the second is 2,
536
* and so on
537
* @param cal the {@code Calendar} object the driver will use
538
* to construct the time
539
* @return the parameter value; if the value is SQL {@code NULL}, the result
540
* is {@code null}.
541
* @throws SQLException if the parameterIndex is not valid;
542
* if a database access error occurs or
543
* this method is called on a closed {@code CallableStatement}
544
* @see #setTime
545
* @since 1.2
546
*/
547
java.sql.Time getTime(int parameterIndex, Calendar cal)
548
throws SQLException;
549
550
/**
551
* Retrieves the value of the designated JDBC {@code TIMESTAMP} parameter as a
552
* {@code java.sql.Timestamp} object, using
553
* the given {@code Calendar} object to construct
554
* the {@code Timestamp} object.
555
* With a {@code Calendar} object, the driver
556
* can calculate the timestamp taking into account a custom timezone and locale.
557
* If no {@code Calendar} object is specified, the driver uses the
558
* default timezone and locale.
559
*
560
*
561
* @param parameterIndex the first parameter is 1, the second is 2,
562
* and so on
563
* @param cal the {@code Calendar} object the driver will use
564
* to construct the timestamp
565
* @return the parameter value. If the value is SQL {@code NULL}, the result
566
* is {@code null}.
567
* @throws SQLException if the parameterIndex is not valid;
568
* if a database access error occurs or
569
* this method is called on a closed {@code CallableStatement}
570
* @see #setTimestamp
571
* @since 1.2
572
*/
573
java.sql.Timestamp getTimestamp(int parameterIndex, Calendar cal)
574
throws SQLException;
575
576
577
/**
578
* Registers the designated output parameter.
579
* This version of
580
* the method {@code registerOutParameter}
581
* should be used for a user-defined or {@code REF} output parameter. Examples
582
* of user-defined types include: {@code STRUCT}, {@code DISTINCT},
583
* {@code JAVA_OBJECT}, and named array types.
584
*<p>
585
* All OUT parameters must be registered
586
* before a stored procedure is executed.
587
* <p> For a user-defined parameter, the fully-qualified SQL
588
* type name of the parameter should also be given, while a {@code REF}
589
* parameter requires that the fully-qualified type name of the
590
* referenced type be given. A JDBC driver that does not need the
591
* type code and type name information may ignore it. To be portable,
592
* however, applications should always provide these values for
593
* user-defined and {@code REF} parameters.
594
*
595
* Although it is intended for user-defined and {@code REF} parameters,
596
* this method may be used to register a parameter of any JDBC type.
597
* If the parameter does not have a user-defined or {@code REF} type, the
598
* <i>typeName</i> parameter is ignored.
599
*
600
* <P><B>Note:</B> When reading the value of an out parameter, you
601
* must use the getter method whose Java type corresponds to the
602
* parameter's registered SQL type.
603
*
604
* @param parameterIndex the first parameter is 1, the second is 2,...
605
* @param sqlType a value from {@link java.sql.Types}
606
* @param typeName the fully-qualified name of an SQL structured type
607
* @throws SQLException if the parameterIndex is not valid;
608
* if a database access error occurs or
609
* this method is called on a closed {@code CallableStatement}
610
* @throws SQLFeatureNotSupportedException if {@code sqlType} is
611
* a {@code ARRAY}, {@code BLOB}, {@code CLOB},
612
* {@code DATALINK}, {@code JAVA_OBJECT}, {@code NCHAR},
613
* {@code NCLOB}, {@code NVARCHAR}, {@code LONGNVARCHAR},
614
* {@code REF}, {@code ROWID}, {@code SQLXML}
615
* or {@code STRUCT} data type and the JDBC driver does not support
616
* this data type
617
* @see Types
618
* @since 1.2
619
*/
620
void registerOutParameter (int parameterIndex, int sqlType, String typeName)
621
throws SQLException;
622
623
//--------------------------JDBC 3.0-----------------------------
624
625
/**
626
* Registers the OUT parameter named
627
* {@code parameterName} to the JDBC type
628
* {@code sqlType}. All OUT parameters must be registered
629
* before a stored procedure is executed.
630
* <p>
631
* The JDBC type specified by {@code sqlType} for an OUT
632
* parameter determines the Java type that must be used
633
* in the {@code get} method to read the value of that parameter.
634
* <p>
635
* If the JDBC type expected to be returned to this output parameter
636
* is specific to this particular database, {@code sqlType}
637
* should be {@code java.sql.Types.OTHER}. The method
638
* {@link #getObject} retrieves the value.
639
* @param parameterName the name of the parameter
640
* @param sqlType the JDBC type code defined by {@code java.sql.Types}.
641
* If the parameter is of JDBC type {@code NUMERIC}
642
* or {@code DECIMAL}, the version of
643
* {@code registerOutParameter} that accepts a scale value
644
* should be used.
645
* @throws SQLException if parameterName does not correspond to a named
646
* parameter; if a database access error occurs or
647
* this method is called on a closed {@code CallableStatement}
648
* @throws SQLFeatureNotSupportedException if {@code sqlType} is
649
* a {@code ARRAY}, {@code BLOB}, {@code CLOB},
650
* {@code DATALINK}, {@code JAVA_OBJECT}, {@code NCHAR},
651
* {@code NCLOB}, {@code NVARCHAR}, {@code LONGNVARCHAR},
652
* {@code REF}, {@code ROWID}, {@code SQLXML}
653
* or {@code STRUCT} data type and the JDBC driver does not support
654
* this data type or if the JDBC driver does not support
655
* this method
656
* @since 1.4
657
* @see Types
658
*/
659
void registerOutParameter(String parameterName, int sqlType)
660
throws SQLException;
661
662
/**
663
* Registers the parameter named
664
* {@code parameterName} to be of JDBC type
665
* {@code sqlType}. All OUT parameters must be registered
666
* before a stored procedure is executed.
667
* <p>
668
* The JDBC type specified by {@code sqlType} for an OUT
669
* parameter determines the Java type that must be used
670
* in the {@code get} method to read the value of that parameter.
671
* <p>
672
* This version of {@code registerOutParameter} should be
673
* used when the parameter is of JDBC type {@code NUMERIC}
674
* or {@code DECIMAL}.
675
*
676
* @param parameterName the name of the parameter
677
* @param sqlType SQL type code defined by {@code java.sql.Types}.
678
* @param scale the desired number of digits to the right of the
679
* decimal point. It must be greater than or equal to zero.
680
* @throws SQLException if parameterName does not correspond to a named
681
* parameter; if a database access error occurs or
682
* this method is called on a closed {@code CallableStatement}
683
* @throws SQLFeatureNotSupportedException if {@code sqlType} is
684
* a {@code ARRAY}, {@code BLOB}, {@code CLOB},
685
* {@code DATALINK}, {@code JAVA_OBJECT}, {@code NCHAR},
686
* {@code NCLOB}, {@code NVARCHAR}, {@code LONGNVARCHAR},
687
* {@code REF}, {@code ROWID}, {@code SQLXML}
688
* or {@code STRUCT} data type and the JDBC driver does not support
689
* this data type or if the JDBC driver does not support
690
* this method
691
* @since 1.4
692
* @see Types
693
*/
694
void registerOutParameter(String parameterName, int sqlType, int scale)
695
throws SQLException;
696
697
/**
698
* Registers the designated output parameter. This version of
699
* the method {@code registerOutParameter}
700
* should be used for a user-named or REF output parameter. Examples
701
* of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
702
* named array types.
703
*<p>
704
* All OUT parameters must be registered
705
* before a stored procedure is executed.
706
* <p>
707
* For a user-named parameter the fully-qualified SQL
708
* type name of the parameter should also be given, while a REF
709
* parameter requires that the fully-qualified type name of the
710
* referenced type be given. A JDBC driver that does not need the
711
* type code and type name information may ignore it. To be portable,
712
* however, applications should always provide these values for
713
* user-named and REF parameters.
714
*
715
* Although it is intended for user-named and REF parameters,
716
* this method may be used to register a parameter of any JDBC type.
717
* If the parameter does not have a user-named or REF type, the
718
* typeName parameter is ignored.
719
*
720
* <P><B>Note:</B> When reading the value of an out parameter, you
721
* must use the {@code getXXX} method whose Java type XXX corresponds to the
722
* parameter's registered SQL type.
723
*
724
* @param parameterName the name of the parameter
725
* @param sqlType a value from {@link java.sql.Types}
726
* @param typeName the fully-qualified name of an SQL structured type
727
* @throws SQLException if parameterName does not correspond to a named
728
* parameter; if a database access error occurs or
729
* this method is called on a closed {@code CallableStatement}
730
* @throws SQLFeatureNotSupportedException if {@code sqlType} is
731
* a {@code ARRAY}, {@code BLOB}, {@code CLOB},
732
* {@code DATALINK}, {@code JAVA_OBJECT}, {@code NCHAR},
733
* {@code NCLOB}, {@code NVARCHAR}, {@code LONGNVARCHAR},
734
* {@code REF}, {@code ROWID}, {@code SQLXML}
735
* or {@code STRUCT} data type and the JDBC driver does not support
736
* this data type or if the JDBC driver does not support
737
* this method
738
* @see Types
739
* @since 1.4
740
*/
741
void registerOutParameter (String parameterName, int sqlType, String typeName)
742
throws SQLException;
743
744
/**
745
* Retrieves the value of the designated JDBC {@code DATALINK} parameter as a
746
* {@code java.net.URL} object.
747
*
748
* @param parameterIndex the first parameter is 1, the second is 2,...
749
* @return a {@code java.net.URL} object that represents the
750
* JDBC {@code DATALINK} value used as the designated
751
* parameter
752
* @throws SQLException if the parameterIndex is not valid;
753
* if a database access error occurs,
754
* this method is called on a closed {@code CallableStatement},
755
* or if the URL being returned is
756
* not a valid URL on the Java platform
757
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
758
* this method
759
* @see #setURL
760
* @since 1.4
761
*/
762
java.net.URL getURL(int parameterIndex) throws SQLException;
763
764
/**
765
* Sets the designated parameter to the given {@code java.net.URL} object.
766
* The driver converts this to an SQL {@code DATALINK} value when
767
* it sends it to the database.
768
*
769
* @param parameterName the name of the parameter
770
* @param val the parameter value
771
* @throws SQLException if parameterName does not correspond to a named
772
* parameter; if a database access error occurs;
773
* this method is called on a closed {@code CallableStatement}
774
* or if a URL is malformed
775
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
776
* this method
777
* @see #getURL
778
* @since 1.4
779
*/
780
void setURL(String parameterName, java.net.URL val) throws SQLException;
781
782
/**
783
* Sets the designated parameter to SQL {@code NULL}.
784
*
785
* <P><B>Note:</B> You must specify the parameter's SQL type.
786
*
787
* @param parameterName the name of the parameter
788
* @param sqlType the SQL type code defined in {@code java.sql.Types}
789
* @throws SQLException if parameterName does not correspond to a named
790
* parameter; if a database access error occurs or
791
* this method is called on a closed {@code CallableStatement}
792
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
793
* this method
794
* @since 1.4
795
*/
796
void setNull(String parameterName, int sqlType) throws SQLException;
797
798
/**
799
* Sets the designated parameter to the given Java {@code boolean} value.
800
* The driver converts this
801
* to an SQL {@code BIT} or {@code BOOLEAN} value when it sends it to the database.
802
*
803
* @param parameterName the name of the parameter
804
* @param x the parameter value
805
* @throws SQLException if parameterName does not correspond to a named
806
* parameter; if a database access error occurs or
807
* this method is called on a closed {@code CallableStatement}
808
* @see #getBoolean
809
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
810
* this method
811
* @since 1.4
812
*/
813
void setBoolean(String parameterName, boolean x) throws SQLException;
814
815
/**
816
* Sets the designated parameter to the given Java {@code byte} value.
817
* The driver converts this
818
* to an SQL {@code TINYINT} value when it sends it to the database.
819
*
820
* @param parameterName the name of the parameter
821
* @param x the parameter value
822
* @throws SQLException if parameterName does not correspond to a named
823
* parameter; if a database access error occurs or
824
* this method is called on a closed {@code CallableStatement}
825
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
826
* this method
827
* @see #getByte
828
* @since 1.4
829
*/
830
void setByte(String parameterName, byte x) throws SQLException;
831
832
/**
833
* Sets the designated parameter to the given Java {@code short} value.
834
* The driver converts this
835
* to an SQL {@code SMALLINT} value when it sends it to the database.
836
*
837
* @param parameterName the name of the parameter
838
* @param x the parameter value
839
* @throws SQLException if parameterName does not correspond to a named
840
* parameter; if a database access error occurs or
841
* this method is called on a closed {@code CallableStatement}
842
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
843
* this method
844
* @see #getShort
845
* @since 1.4
846
*/
847
void setShort(String parameterName, short x) throws SQLException;
848
849
/**
850
* Sets the designated parameter to the given Java {@code int} value.
851
* The driver converts this
852
* to an SQL {@code INTEGER} value when it sends it to the database.
853
*
854
* @param parameterName the name of the parameter
855
* @param x the parameter value
856
* @throws SQLException if parameterName does not correspond to a named
857
* parameter; if a database access error occurs or
858
* this method is called on a closed {@code CallableStatement}
859
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
860
* this method
861
* @see #getInt
862
* @since 1.4
863
*/
864
void setInt(String parameterName, int x) throws SQLException;
865
866
/**
867
* Sets the designated parameter to the given Java {@code long} value.
868
* The driver converts this
869
* to an SQL {@code BIGINT} value when it sends it to the database.
870
*
871
* @param parameterName the name of the parameter
872
* @param x the parameter value
873
* @throws SQLException if parameterName does not correspond to a named
874
* parameter; if a database access error occurs or
875
* this method is called on a closed {@code CallableStatement}
876
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
877
* this method
878
* @see #getLong
879
* @since 1.4
880
*/
881
void setLong(String parameterName, long x) throws SQLException;
882
883
/**
884
* Sets the designated parameter to the given Java {@code float} value.
885
* The driver converts this
886
* to an SQL {@code FLOAT} value when it sends it to the database.
887
*
888
* @param parameterName the name of the parameter
889
* @param x the parameter value
890
* @throws SQLException if parameterName does not correspond to a named
891
* parameter; if a database access error occurs or
892
* this method is called on a closed {@code CallableStatement}
893
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
894
* this method
895
* @see #getFloat
896
* @since 1.4
897
*/
898
void setFloat(String parameterName, float x) throws SQLException;
899
900
/**
901
* Sets the designated parameter to the given Java {@code double} value.
902
* The driver converts this
903
* to an SQL {@code DOUBLE} value when it sends it to the database.
904
*
905
* @param parameterName the name of the parameter
906
* @param x the parameter value
907
* @throws SQLException if parameterName does not correspond to a named
908
* parameter; if a database access error occurs or
909
* this method is called on a closed {@code CallableStatement}
910
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
911
* this method
912
* @see #getDouble
913
* @since 1.4
914
*/
915
void setDouble(String parameterName, double x) throws SQLException;
916
917
/**
918
* Sets the designated parameter to the given
919
* {@code java.math.BigDecimal} value.
920
* The driver converts this to an SQL {@code NUMERIC} value when
921
* it sends it to the database.
922
*
923
* @param parameterName the name of the parameter
924
* @param x the parameter value
925
* @throws SQLException if parameterName does not correspond to a named
926
* parameter; if a database access error occurs or
927
* this method is called on a closed {@code CallableStatement}
928
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
929
* this method
930
* @see #getBigDecimal
931
* @since 1.4
932
*/
933
void setBigDecimal(String parameterName, BigDecimal x) throws SQLException;
934
935
/**
936
* Sets the designated parameter to the given Java {@code String} value.
937
* The driver converts this
938
* to an SQL {@code VARCHAR} or {@code LONGVARCHAR} value
939
* (depending on the argument's
940
* size relative to the driver's limits on {@code VARCHAR} values)
941
* when it sends it to the database.
942
*
943
* @param parameterName the name of the parameter
944
* @param x the parameter value
945
* @throws SQLException if parameterName does not correspond to a named
946
* parameter; if a database access error occurs or
947
* this method is called on a closed {@code CallableStatement}
948
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
949
* this method
950
* @see #getString
951
* @since 1.4
952
*/
953
void setString(String parameterName, String x) throws SQLException;
954
955
/**
956
* Sets the designated parameter to the given Java array of bytes.
957
* The driver converts this to an SQL {@code VARBINARY} or
958
* {@code LONGVARBINARY} (depending on the argument's size relative
959
* to the driver's limits on {@code VARBINARY} values) when it sends
960
* it to the database.
961
*
962
* @param parameterName the name of the parameter
963
* @param x the parameter value
964
* @throws SQLException if parameterName does not correspond to a named
965
* parameter; if a database access error occurs or
966
* this method is called on a closed {@code CallableStatement}
967
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
968
* this method
969
* @see #getBytes
970
* @since 1.4
971
*/
972
void setBytes(String parameterName, byte x[]) throws SQLException;
973
974
/**
975
* Sets the designated parameter to the given {@code java.sql.Date} value
976
* using the default time zone of the virtual machine that is running
977
* the application.
978
* The driver converts this
979
* to an SQL {@code DATE} value when it sends it to the database.
980
*
981
* @param parameterName the name of the parameter
982
* @param x the parameter value
983
* @throws SQLException if parameterName does not correspond to a named
984
* parameter; if a database access error occurs or
985
* this method is called on a closed {@code CallableStatement}
986
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
987
* this method
988
* @see #getDate
989
* @since 1.4
990
*/
991
void setDate(String parameterName, java.sql.Date x)
992
throws SQLException;
993
994
/**
995
* Sets the designated parameter to the given {@code java.sql.Time} value.
996
* The driver converts this
997
* to an SQL {@code TIME} value when it sends it to the database.
998
*
999
* @param parameterName the name of the parameter
1000
* @param x the parameter value
1001
* @throws SQLException if parameterName does not correspond to a named
1002
* parameter; if a database access error occurs or
1003
* this method is called on a closed {@code CallableStatement}
1004
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1005
* this method
1006
* @see #getTime
1007
* @since 1.4
1008
*/
1009
void setTime(String parameterName, java.sql.Time x)
1010
throws SQLException;
1011
1012
/**
1013
* Sets the designated parameter to the given {@code java.sql.Timestamp} value.
1014
* The driver
1015
* converts this to an SQL {@code TIMESTAMP} value when it sends it to the
1016
* database.
1017
*
1018
* @param parameterName the name of the parameter
1019
* @param x the parameter value
1020
* @throws SQLException if parameterName does not correspond to a named
1021
* parameter; if a database access error occurs or
1022
* this method is called on a closed {@code CallableStatement}
1023
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1024
* this method
1025
* @see #getTimestamp
1026
* @since 1.4
1027
*/
1028
void setTimestamp(String parameterName, java.sql.Timestamp x)
1029
throws SQLException;
1030
1031
/**
1032
* Sets the designated parameter to the given input stream, which will have
1033
* the specified number of bytes.
1034
* When a very large ASCII value is input to a {@code LONGVARCHAR}
1035
* parameter, it may be more practical to send it via a
1036
* {@code java.io.InputStream}. Data will be read from the stream
1037
* as needed until end-of-file is reached. The JDBC driver will
1038
* do any necessary conversion from ASCII to the database char format.
1039
*
1040
* <P><B>Note:</B> This stream object can either be a standard
1041
* Java stream object or your own subclass that implements the
1042
* standard interface.
1043
*
1044
* @param parameterName the name of the parameter
1045
* @param x the Java input stream that contains the ASCII parameter value
1046
* @param length the number of bytes in the stream
1047
* @throws SQLException if parameterName does not correspond to a named
1048
* parameter; if a database access error occurs or
1049
* this method is called on a closed {@code CallableStatement}
1050
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1051
* this method
1052
* @since 1.4
1053
*/
1054
void setAsciiStream(String parameterName, java.io.InputStream x, int length)
1055
throws SQLException;
1056
1057
/**
1058
* Sets the designated parameter to the given input stream, which will have
1059
* the specified number of bytes.
1060
* When a very large binary value is input to a {@code LONGVARBINARY}
1061
* parameter, it may be more practical to send it via a
1062
* {@code java.io.InputStream} object. The data will be read from the stream
1063
* as needed until end-of-file is reached.
1064
*
1065
* <P><B>Note:</B> This stream object can either be a standard
1066
* Java stream object or your own subclass that implements the
1067
* standard interface.
1068
*
1069
* @param parameterName the name of the parameter
1070
* @param x the java input stream which contains the binary parameter value
1071
* @param length the number of bytes in the stream
1072
* @throws SQLException if parameterName does not correspond to a named
1073
* parameter; if a database access error occurs or
1074
* this method is called on a closed {@code CallableStatement}
1075
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1076
* this method
1077
* @since 1.4
1078
*/
1079
void setBinaryStream(String parameterName, java.io.InputStream x,
1080
int length) throws SQLException;
1081
1082
/**
1083
* Sets the value of the designated parameter with the given object.
1084
*
1085
* <p>The given Java object will be converted to the given targetSqlType
1086
* before being sent to the database.
1087
*
1088
* If the object has a custom mapping (is of a class implementing the
1089
* interface {@code SQLData}),
1090
* the JDBC driver should call the method {@code SQLData.writeSQL} to write it
1091
* to the SQL data stream.
1092
* If, on the other hand, the object is of a class implementing
1093
* {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob},
1094
* {@code Struct}, {@code java.net.URL},
1095
* or {@code Array}, the driver should pass it to the database as a
1096
* value of the corresponding SQL type.
1097
* <P>
1098
* Note that this method may be used to pass datatabase-
1099
* specific abstract data types.
1100
*
1101
* @param parameterName the name of the parameter
1102
* @param x the object containing the input parameter value
1103
* @param targetSqlType the SQL type (as defined in java.sql.Types) to be
1104
* sent to the database. The scale argument may further qualify this type.
1105
* @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
1106
* this is the number of digits after the decimal point. For all other
1107
* types, this value will be ignored.
1108
* @throws SQLException if parameterName does not correspond to a named
1109
* parameter; if a database access error occurs or
1110
* this method is called on a closed {@code CallableStatement}
1111
* @throws SQLFeatureNotSupportedException if
1112
* the JDBC driver does not support the specified targetSqlType
1113
* @see Types
1114
* @see #getObject
1115
* @since 1.4
1116
*/
1117
void setObject(String parameterName, Object x, int targetSqlType, int scale)
1118
throws SQLException;
1119
1120
/**
1121
* Sets the value of the designated parameter with the given object.
1122
*
1123
* This method is similar to {@link #setObject(String parameterName,
1124
* Object x, int targetSqlType, int scaleOrLength)},
1125
* except that it assumes a scale of zero.
1126
*
1127
* @param parameterName the name of the parameter
1128
* @param x the object containing the input parameter value
1129
* @param targetSqlType the SQL type (as defined in java.sql.Types) to be
1130
* sent to the database
1131
* @throws SQLException if parameterName does not correspond to a named
1132
* parameter; if a database access error occurs or
1133
* this method is called on a closed {@code CallableStatement}
1134
* @throws SQLFeatureNotSupportedException if
1135
* the JDBC driver does not support the specified targetSqlType
1136
* @see #getObject
1137
* @since 1.4
1138
*/
1139
void setObject(String parameterName, Object x, int targetSqlType)
1140
throws SQLException;
1141
1142
/**
1143
* Sets the value of the designated parameter with the given object.
1144
*
1145
* <p>The JDBC specification specifies a standard mapping from
1146
* Java {@code Object} types to SQL types. The given argument
1147
* will be converted to the corresponding SQL type before being
1148
* sent to the database.
1149
* <p>Note that this method may be used to pass database-
1150
* specific abstract data types, by using a driver-specific Java
1151
* type.
1152
*
1153
* If the object is of a class implementing the interface {@code SQLData},
1154
* the JDBC driver should call the method {@code SQLData.writeSQL}
1155
* to write it to the SQL data stream.
1156
* If, on the other hand, the object is of a class implementing
1157
* {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob},
1158
* {@code Struct}, {@code java.net.URL},
1159
* or {@code Array}, the driver should pass it to the database as a
1160
* value of the corresponding SQL type.
1161
* <P>
1162
* This method throws an exception if there is an ambiguity, for example, if the
1163
* object is of a class implementing more than one of the interfaces named above.
1164
* <p>
1165
*<b>Note:</b> Not all databases allow for a non-typed Null to be sent to
1166
* the backend. For maximum portability, the {@code setNull} or the
1167
* {@code setObject(String parameterName, Object x, int sqlType)}
1168
* method should be used
1169
* instead of {@code setObject(String parameterName, Object x)}.
1170
*
1171
* @param parameterName the name of the parameter
1172
* @param x the object containing the input parameter value
1173
* @throws SQLException if parameterName does not correspond to a named
1174
* parameter; if a database access error occurs,
1175
* this method is called on a closed {@code CallableStatement} or if the given
1176
* {@code Object} parameter is ambiguous
1177
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1178
* this method
1179
* @see #getObject
1180
* @since 1.4
1181
*/
1182
void setObject(String parameterName, Object x) throws SQLException;
1183
1184
1185
/**
1186
* Sets the designated parameter to the given {@code Reader}
1187
* object, which is the given number of characters long.
1188
* When a very large UNICODE value is input to a {@code LONGVARCHAR}
1189
* parameter, it may be more practical to send it via a
1190
* {@code java.io.Reader} object. The data will be read from the stream
1191
* as needed until end-of-file is reached. The JDBC driver will
1192
* do any necessary conversion from UNICODE to the database char format.
1193
*
1194
* <P><B>Note:</B> This stream object can either be a standard
1195
* Java stream object or your own subclass that implements the
1196
* standard interface.
1197
*
1198
* @param parameterName the name of the parameter
1199
* @param reader the {@code java.io.Reader} object that
1200
* contains the UNICODE data used as the designated parameter
1201
* @param length the number of characters in the stream
1202
* @throws SQLException if parameterName does not correspond to a named
1203
* parameter; if a database access error occurs or
1204
* this method is called on a closed {@code CallableStatement}
1205
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1206
* this method
1207
* @since 1.4
1208
*/
1209
void setCharacterStream(String parameterName,
1210
java.io.Reader reader,
1211
int length) throws SQLException;
1212
1213
/**
1214
* Sets the designated parameter to the given {@code java.sql.Date} value,
1215
* using the given {@code Calendar} object. The driver uses
1216
* the {@code Calendar} object to construct an SQL {@code DATE} value,
1217
* which the driver then sends to the database. With a
1218
* a {@code Calendar} object, the driver can calculate the date
1219
* taking into account a custom timezone. If no
1220
* {@code Calendar} object is specified, the driver uses the default
1221
* timezone, which is that of the virtual machine running the application.
1222
*
1223
* @param parameterName the name of the parameter
1224
* @param x the parameter value
1225
* @param cal the {@code Calendar} object the driver will use
1226
* to construct the date
1227
* @throws SQLException if parameterName does not correspond to a named
1228
* parameter; if a database access error occurs or
1229
* this method is called on a closed {@code CallableStatement}
1230
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1231
* this method
1232
* @see #getDate
1233
* @since 1.4
1234
*/
1235
void setDate(String parameterName, java.sql.Date x, Calendar cal)
1236
throws SQLException;
1237
1238
/**
1239
* Sets the designated parameter to the given {@code java.sql.Time} value,
1240
* using the given {@code Calendar} object. The driver uses
1241
* the {@code Calendar} object to construct an SQL {@code TIME} value,
1242
* which the driver then sends to the database. With a
1243
* a {@code Calendar} object, the driver can calculate the time
1244
* taking into account a custom timezone. If no
1245
* {@code Calendar} object is specified, the driver uses the default
1246
* timezone, which is that of the virtual machine running the application.
1247
*
1248
* @param parameterName the name of the parameter
1249
* @param x the parameter value
1250
* @param cal the {@code Calendar} object the driver will use
1251
* to construct the time
1252
* @throws SQLException if parameterName does not correspond to a named
1253
* parameter; if a database access error occurs or
1254
* this method is called on a closed {@code CallableStatement}
1255
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1256
* this method
1257
* @see #getTime
1258
* @since 1.4
1259
*/
1260
void setTime(String parameterName, java.sql.Time x, Calendar cal)
1261
throws SQLException;
1262
1263
/**
1264
* Sets the designated parameter to the given {@code java.sql.Timestamp} value,
1265
* using the given {@code Calendar} object. The driver uses
1266
* the {@code Calendar} object to construct an SQL {@code TIMESTAMP} value,
1267
* which the driver then sends to the database. With a
1268
* a {@code Calendar} object, the driver can calculate the timestamp
1269
* taking into account a custom timezone. If no
1270
* {@code Calendar} object is specified, the driver uses the default
1271
* timezone, which is that of the virtual machine running the application.
1272
*
1273
* @param parameterName the name of the parameter
1274
* @param x the parameter value
1275
* @param cal the {@code Calendar} object the driver will use
1276
* to construct the timestamp
1277
* @throws SQLException if parameterName does not correspond to a named
1278
* parameter; if a database access error occurs or
1279
* this method is called on a closed {@code CallableStatement}
1280
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1281
* this method
1282
* @see #getTimestamp
1283
* @since 1.4
1284
*/
1285
void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal)
1286
throws SQLException;
1287
1288
/**
1289
* Sets the designated parameter to SQL {@code NULL}.
1290
* This version of the method {@code setNull} should
1291
* be used for user-defined types and REF type parameters. Examples
1292
* of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
1293
* named array types.
1294
*
1295
* <P><B>Note:</B> To be portable, applications must give the
1296
* SQL type code and the fully-qualified SQL type name when specifying
1297
* a NULL user-defined or REF parameter. In the case of a user-defined type
1298
* the name is the type name of the parameter itself. For a REF
1299
* parameter, the name is the type name of the referenced type.
1300
* <p>
1301
* Although it is intended for user-defined and Ref parameters,
1302
* this method may be used to set a null parameter of any JDBC type.
1303
* If the parameter does not have a user-defined or REF type, the given
1304
* typeName is ignored.
1305
*
1306
*
1307
* @param parameterName the name of the parameter
1308
* @param sqlType a value from {@code java.sql.Types}
1309
* @param typeName the fully-qualified name of an SQL user-defined type;
1310
* ignored if the parameter is not a user-defined type or
1311
* SQL {@code REF} value
1312
* @throws SQLException if parameterName does not correspond to a named
1313
* parameter; if a database access error occurs or
1314
* this method is called on a closed {@code CallableStatement}
1315
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1316
* this method
1317
* @since 1.4
1318
*/
1319
void setNull (String parameterName, int sqlType, String typeName)
1320
throws SQLException;
1321
1322
/**
1323
* Retrieves the value of a JDBC {@code CHAR}, {@code VARCHAR},
1324
* or {@code LONGVARCHAR} parameter as a {@code String} in
1325
* the Java programming language.
1326
* <p>
1327
* For the fixed-length type JDBC {@code CHAR},
1328
* the {@code String} object
1329
* returned has exactly the same value the SQL
1330
* {@code CHAR} value had in the
1331
* database, including any padding added by the database.
1332
* @param parameterName the name of the parameter
1333
* @return the parameter value. If the value is SQL {@code NULL}, the result
1334
* is {@code null}.
1335
* @throws SQLException if parameterName does not correspond to a named
1336
* parameter; if a database access error occurs or
1337
* this method is called on a closed {@code CallableStatement}
1338
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1339
* this method
1340
* @see #setString
1341
* @since 1.4
1342
*/
1343
String getString(String parameterName) throws SQLException;
1344
1345
/**
1346
* Retrieves the value of a JDBC {@code BIT} or {@code BOOLEAN}
1347
* parameter as a
1348
* {@code boolean} in the Java programming language.
1349
* @param parameterName the name of the parameter
1350
* @return the parameter value. If the value is SQL {@code NULL}, the result
1351
* is {@code false}.
1352
* @throws SQLException if parameterName does not correspond to a named
1353
* parameter; if a database access error occurs or
1354
* this method is called on a closed {@code CallableStatement}
1355
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1356
* this method
1357
* @see #setBoolean
1358
* @since 1.4
1359
*/
1360
boolean getBoolean(String parameterName) throws SQLException;
1361
1362
/**
1363
* Retrieves the value of a JDBC {@code TINYINT} parameter as a {@code byte}
1364
* in the Java programming language.
1365
* @param parameterName the name of the parameter
1366
* @return the parameter value. If the value is SQL {@code NULL}, the result
1367
* is {@code 0}.
1368
* @throws SQLException if parameterName does not correspond to a named
1369
* parameter; if a database access error occurs or
1370
* this method is called on a closed {@code CallableStatement}
1371
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1372
* this method
1373
* @see #setByte
1374
* @since 1.4
1375
*/
1376
byte getByte(String parameterName) throws SQLException;
1377
1378
/**
1379
* Retrieves the value of a JDBC {@code SMALLINT} parameter as a {@code short}
1380
* in the Java programming language.
1381
* @param parameterName the name of the parameter
1382
* @return the parameter value. If the value is SQL {@code NULL}, the result
1383
* is {@code 0}.
1384
* @throws SQLException if parameterName does not correspond to a named
1385
* parameter; if a database access error occurs or
1386
* this method is called on a closed {@code CallableStatement}
1387
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1388
* this method
1389
* @see #setShort
1390
* @since 1.4
1391
*/
1392
short getShort(String parameterName) throws SQLException;
1393
1394
/**
1395
* Retrieves the value of a JDBC {@code INTEGER} parameter as an {@code int}
1396
* in the Java programming language.
1397
*
1398
* @param parameterName the name of the parameter
1399
* @return the parameter value. If the value is SQL {@code NULL},
1400
* the result is {@code 0}.
1401
* @throws SQLException if parameterName does not correspond to a named
1402
* parameter; if a database access error occurs or
1403
* this method is called on a closed {@code CallableStatement}
1404
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1405
* this method
1406
* @see #setInt
1407
* @since 1.4
1408
*/
1409
int getInt(String parameterName) throws SQLException;
1410
1411
/**
1412
* Retrieves the value of a JDBC {@code BIGINT} parameter as a {@code long}
1413
* in the Java programming language.
1414
*
1415
* @param parameterName the name of the parameter
1416
* @return the parameter value. If the value is SQL {@code NULL},
1417
* the result is {@code 0}.
1418
* @throws SQLException if parameterName does not correspond to a named
1419
* parameter; if a database access error occurs or
1420
* this method is called on a closed {@code CallableStatement}
1421
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1422
* this method
1423
* @see #setLong
1424
* @since 1.4
1425
*/
1426
long getLong(String parameterName) throws SQLException;
1427
1428
/**
1429
* Retrieves the value of a JDBC {@code FLOAT} parameter as a {@code float}
1430
* in the Java programming language.
1431
* @param parameterName the name of the parameter
1432
* @return the parameter value. If the value is SQL {@code NULL},
1433
* the result is {@code 0}.
1434
* @throws SQLException if parameterName does not correspond to a named
1435
* parameter; if a database access error occurs or
1436
* this method is called on a closed {@code CallableStatement}
1437
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1438
* this method
1439
* @see #setFloat
1440
* @since 1.4
1441
*/
1442
float getFloat(String parameterName) throws SQLException;
1443
1444
/**
1445
* Retrieves the value of a JDBC {@code DOUBLE} parameter as a {@code double}
1446
* in the Java programming language.
1447
* @param parameterName the name of the parameter
1448
* @return the parameter value. If the value is SQL {@code NULL},
1449
* the result is {@code 0}.
1450
* @throws SQLException if parameterName does not correspond to a named
1451
* parameter; if a database access error occurs or
1452
* this method is called on a closed {@code CallableStatement}
1453
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1454
* this method
1455
* @see #setDouble
1456
* @since 1.4
1457
*/
1458
double getDouble(String parameterName) throws SQLException;
1459
1460
/**
1461
* Retrieves the value of a JDBC {@code BINARY} or {@code VARBINARY}
1462
* parameter as an array of {@code byte} values in the Java
1463
* programming language.
1464
* @param parameterName the name of the parameter
1465
* @return the parameter value. If the value is SQL {@code NULL}, the result is
1466
* {@code null}.
1467
* @throws SQLException if parameterName does not correspond to a named
1468
* parameter; if a database access error occurs or
1469
* this method is called on a closed {@code CallableStatement}
1470
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1471
* this method
1472
* @see #setBytes
1473
* @since 1.4
1474
*/
1475
byte[] getBytes(String parameterName) throws SQLException;
1476
1477
/**
1478
* Retrieves the value of a JDBC {@code DATE} parameter as a
1479
* {@code java.sql.Date} object.
1480
* @param parameterName the name of the parameter
1481
* @return the parameter value. If the value is SQL {@code NULL}, the result
1482
* is {@code null}.
1483
* @throws SQLException if parameterName does not correspond to a named
1484
* parameter; if a database access error occurs or
1485
* this method is called on a closed {@code CallableStatement}
1486
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1487
* this method
1488
* @see #setDate
1489
* @since 1.4
1490
*/
1491
java.sql.Date getDate(String parameterName) throws SQLException;
1492
1493
/**
1494
* Retrieves the value of a JDBC {@code TIME} parameter as a
1495
* {@code java.sql.Time} object.
1496
* @param parameterName the name of the parameter
1497
* @return the parameter value. If the value is SQL {@code NULL}, the result
1498
* is {@code null}.
1499
* @throws SQLException if parameterName does not correspond to a named
1500
* parameter; if a database access error occurs or
1501
* this method is called on a closed {@code CallableStatement}
1502
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1503
* this method
1504
* @see #setTime
1505
* @since 1.4
1506
*/
1507
java.sql.Time getTime(String parameterName) throws SQLException;
1508
1509
/**
1510
* Retrieves the value of a JDBC {@code TIMESTAMP} parameter as a
1511
* {@code java.sql.Timestamp} object.
1512
* @param parameterName the name of the parameter
1513
* @return the parameter value. If the value is SQL {@code NULL}, the result
1514
* is {@code null}.
1515
* @throws SQLException if parameterName does not correspond to a named
1516
* parameter; if a database access error occurs or
1517
* this method is called on a closed {@code CallableStatement}
1518
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1519
* this method
1520
* @see #setTimestamp
1521
* @since 1.4
1522
*/
1523
java.sql.Timestamp getTimestamp(String parameterName) throws SQLException;
1524
1525
/**
1526
* Retrieves the value of a parameter as an {@code Object} in the Java
1527
* programming language. If the value is an SQL {@code NULL}, the
1528
* driver returns a Java {@code null}.
1529
* <p>
1530
* This method returns a Java object whose type corresponds to the JDBC
1531
* type that was registered for this parameter using the method
1532
* {@code registerOutParameter}. By registering the target JDBC
1533
* type as {@code java.sql.Types.OTHER}, this method can be used
1534
* to read database-specific abstract data types.
1535
* @param parameterName the name of the parameter
1536
* @return A {@code java.lang.Object} holding the OUT parameter value.
1537
* @throws SQLException if parameterName does not correspond to a named
1538
* parameter; if a database access error occurs or
1539
* this method is called on a closed {@code CallableStatement}
1540
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1541
* this method
1542
* @see Types
1543
* @see #setObject
1544
* @since 1.4
1545
*/
1546
Object getObject(String parameterName) throws SQLException;
1547
1548
/**
1549
* Retrieves the value of a JDBC {@code NUMERIC} parameter as a
1550
* {@code java.math.BigDecimal} object with as many digits to the
1551
* right of the decimal point as the value contains.
1552
* @param parameterName the name of the parameter
1553
* @return the parameter value in full precision. If the value is
1554
* SQL {@code NULL}, the result is {@code null}.
1555
* @throws SQLException if parameterName does not correspond to a named
1556
* parameter; if a database access error occurs or
1557
* this method is called on a closed {@code CallableStatement}
1558
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1559
* this method
1560
* @see #setBigDecimal
1561
* @since 1.4
1562
*/
1563
BigDecimal getBigDecimal(String parameterName) throws SQLException;
1564
1565
/**
1566
* Returns an object representing the value of OUT parameter
1567
* {@code parameterName} and uses {@code map} for the custom
1568
* mapping of the parameter value.
1569
* <p>
1570
* This method returns a Java object whose type corresponds to the
1571
* JDBC type that was registered for this parameter using the method
1572
* {@code registerOutParameter}. By registering the target
1573
* JDBC type as {@code java.sql.Types.OTHER}, this method can
1574
* be used to read database-specific abstract data types.
1575
* @param parameterName the name of the parameter
1576
* @param map the mapping from SQL type names to Java classes
1577
* @return a {@code java.lang.Object} holding the OUT parameter value
1578
* @throws SQLException if parameterName does not correspond to a named
1579
* parameter; if a database access error occurs or
1580
* this method is called on a closed {@code CallableStatement}
1581
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1582
* this method
1583
* @see #setObject
1584
* @since 1.4
1585
*/
1586
Object getObject(String parameterName, java.util.Map<String,Class<?>> map)
1587
throws SQLException;
1588
1589
/**
1590
* Retrieves the value of a JDBC {@code REF(<structured-type>)}
1591
* parameter as a {@link java.sql.Ref} object in the Java programming language.
1592
*
1593
* @param parameterName the name of the parameter
1594
* @return the parameter value as a {@code Ref} object in the
1595
* Java programming language. If the value was SQL {@code NULL},
1596
* the value {@code null} is returned.
1597
* @throws SQLException if parameterName does not correspond to a named
1598
* parameter; if a database access error occurs or
1599
* this method is called on a closed {@code CallableStatement}
1600
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1601
* this method
1602
* @since 1.4
1603
*/
1604
Ref getRef (String parameterName) throws SQLException;
1605
1606
/**
1607
* Retrieves the value of a JDBC {@code BLOB} parameter as a
1608
* {@link java.sql.Blob} object in the Java programming language.
1609
*
1610
* @param parameterName the name of the parameter
1611
* @return the parameter value as a {@code Blob} object in the
1612
* Java programming language. If the value was SQL {@code NULL},
1613
* the value {@code null} is returned.
1614
* @throws SQLException if parameterName does not correspond to a named
1615
* parameter; if a database access error occurs or
1616
* this method is called on a closed {@code CallableStatement}
1617
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1618
* this method
1619
* @since 1.4
1620
*/
1621
Blob getBlob (String parameterName) throws SQLException;
1622
1623
/**
1624
* Retrieves the value of a JDBC {@code CLOB} parameter as a
1625
* {@code java.sql.Clob} object in the Java programming language.
1626
* @param parameterName the name of the parameter
1627
* @return the parameter value as a {@code Clob} object in the
1628
* Java programming language. If the value was SQL {@code NULL},
1629
* the value {@code null} is returned.
1630
* @throws SQLException if parameterName does not correspond to a named
1631
* parameter; if a database access error occurs or
1632
* this method is called on a closed {@code CallableStatement}
1633
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1634
* this method
1635
* @since 1.4
1636
*/
1637
Clob getClob (String parameterName) throws SQLException;
1638
1639
/**
1640
* Retrieves the value of a JDBC {@code ARRAY} parameter as an
1641
* {@link java.sql.Array} object in the Java programming language.
1642
*
1643
* @param parameterName the name of the parameter
1644
* @return the parameter value as an {@code Array} object in
1645
* Java programming language. If the value was SQL {@code NULL},
1646
* the value {@code null} is returned.
1647
* @throws SQLException if parameterName does not correspond to a named
1648
* parameter; if a database access error occurs or
1649
* this method is called on a closed {@code CallableStatement}
1650
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1651
* this method
1652
* @since 1.4
1653
*/
1654
Array getArray (String parameterName) throws SQLException;
1655
1656
/**
1657
* Retrieves the value of a JDBC {@code DATE} parameter as a
1658
* {@code java.sql.Date} object, using
1659
* the given {@code Calendar} object
1660
* to construct the date.
1661
* With a {@code Calendar} object, the driver
1662
* can calculate the date taking into account a custom timezone and locale.
1663
* If no {@code Calendar} object is specified, the driver uses the
1664
* default timezone and locale.
1665
*
1666
* @param parameterName the name of the parameter
1667
* @param cal the {@code Calendar} object the driver will use
1668
* to construct the date
1669
* @return the parameter value. If the value is SQL {@code NULL},
1670
* the result is {@code null}.
1671
* @throws SQLException if parameterName does not correspond to a named
1672
* parameter; if a database access error occurs or
1673
* this method is called on a closed {@code CallableStatement}
1674
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1675
* this method
1676
* @see #setDate
1677
* @since 1.4
1678
*/
1679
java.sql.Date getDate(String parameterName, Calendar cal)
1680
throws SQLException;
1681
1682
/**
1683
* Retrieves the value of a JDBC {@code TIME} parameter as a
1684
* {@code java.sql.Time} object, using
1685
* the given {@code Calendar} object
1686
* to construct the time.
1687
* With a {@code Calendar} object, the driver
1688
* can calculate the time taking into account a custom timezone and locale.
1689
* If no {@code Calendar} object is specified, the driver uses the
1690
* default timezone and locale.
1691
*
1692
* @param parameterName the name of the parameter
1693
* @param cal the {@code Calendar} object the driver will use
1694
* to construct the time
1695
* @return the parameter value; if the value is SQL {@code NULL}, the result is
1696
* {@code null}.
1697
* @throws SQLException if parameterName does not correspond to a named
1698
* parameter; if a database access error occurs or
1699
* this method is called on a closed {@code CallableStatement}
1700
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1701
* this method
1702
* @see #setTime
1703
* @since 1.4
1704
*/
1705
java.sql.Time getTime(String parameterName, Calendar cal)
1706
throws SQLException;
1707
1708
/**
1709
* Retrieves the value of a JDBC {@code TIMESTAMP} parameter as a
1710
* {@code java.sql.Timestamp} object, using
1711
* the given {@code Calendar} object to construct
1712
* the {@code Timestamp} object.
1713
* With a {@code Calendar} object, the driver
1714
* can calculate the timestamp taking into account a custom timezone and locale.
1715
* If no {@code Calendar} object is specified, the driver uses the
1716
* default timezone and locale.
1717
*
1718
*
1719
* @param parameterName the name of the parameter
1720
* @param cal the {@code Calendar} object the driver will use
1721
* to construct the timestamp
1722
* @return the parameter value. If the value is SQL {@code NULL}, the result is
1723
* {@code null}.
1724
* @throws SQLException if parameterName does not correspond to a named
1725
* parameter; if a database access error occurs or
1726
* this method is called on a closed {@code CallableStatement}
1727
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1728
* this method
1729
* @see #setTimestamp
1730
* @since 1.4
1731
*/
1732
java.sql.Timestamp getTimestamp(String parameterName, Calendar cal)
1733
throws SQLException;
1734
1735
/**
1736
* Retrieves the value of a JDBC {@code DATALINK} parameter as a
1737
* {@code java.net.URL} object.
1738
*
1739
* @param parameterName the name of the parameter
1740
* @return the parameter value as a {@code java.net.URL} object in the
1741
* Java programming language. If the value was SQL {@code NULL}, the
1742
* value {@code null} is returned.
1743
* @throws SQLException if parameterName does not correspond to a named
1744
* parameter; if a database access error occurs,
1745
* this method is called on a closed {@code CallableStatement},
1746
* or if there is a problem with the URL
1747
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1748
* this method
1749
* @see #setURL
1750
* @since 1.4
1751
*/
1752
java.net.URL getURL(String parameterName) throws SQLException;
1753
1754
//------------------------- JDBC 4.0 -----------------------------------
1755
1756
/**
1757
* Retrieves the value of the designated JDBC {@code ROWID} parameter as a
1758
* {@code java.sql.RowId} object.
1759
*
1760
* @param parameterIndex the first parameter is 1, the second is 2,...
1761
* @return a {@code RowId} object that represents the JDBC {@code ROWID}
1762
* value is used as the designated parameter. If the parameter contains
1763
* a SQL {@code NULL}, then a {@code null} value is returned.
1764
* @throws SQLException if the parameterIndex is not valid;
1765
* if a database access error occurs or
1766
* this method is called on a closed {@code CallableStatement}
1767
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1768
* this method
1769
* @since 1.6
1770
*/
1771
RowId getRowId(int parameterIndex) throws SQLException;
1772
1773
/**
1774
* Retrieves the value of the designated JDBC {@code ROWID} parameter as a
1775
* {@code java.sql.RowId} object.
1776
*
1777
* @param parameterName the name of the parameter
1778
* @return a {@code RowId} object that represents the JDBC {@code ROWID}
1779
* value is used as the designated parameter. If the parameter contains
1780
* a SQL {@code NULL}, then a {@code null} value is returned.
1781
* @throws SQLException if parameterName does not correspond to a named
1782
* parameter; if a database access error occurs or
1783
* this method is called on a closed {@code CallableStatement}
1784
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1785
* this method
1786
* @since 1.6
1787
*/
1788
RowId getRowId(String parameterName) throws SQLException;
1789
1790
/**
1791
* Sets the designated parameter to the given {@code java.sql.RowId} object. The
1792
* driver converts this to a SQL {@code ROWID} when it sends it to the
1793
* database.
1794
*
1795
* @param parameterName the name of the parameter
1796
* @param x the parameter value
1797
* @throws SQLException if parameterName does not correspond to a named
1798
* parameter; if a database access error occurs or
1799
* this method is called on a closed {@code CallableStatement}
1800
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1801
* this method
1802
* @since 1.6
1803
*/
1804
void setRowId(String parameterName, RowId x) throws SQLException;
1805
1806
/**
1807
* Sets the designated parameter to the given {@code String} object.
1808
* The driver converts this to a SQL {@code NCHAR} or
1809
* {@code NVARCHAR} or {@code LONGNVARCHAR}
1810
* @param parameterName the name of the parameter to be set
1811
* @param value the parameter value
1812
* @throws SQLException if parameterName does not correspond to a named
1813
* parameter; if the driver does not support national
1814
* character sets; if the driver can detect that a data conversion
1815
* error could occur; if a database access error occurs or
1816
* this method is called on a closed {@code CallableStatement}
1817
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1818
* this method
1819
* @since 1.6
1820
*/
1821
void setNString(String parameterName, String value)
1822
throws SQLException;
1823
1824
/**
1825
* Sets the designated parameter to a {@code Reader} object. The
1826
* {@code Reader} reads the data till end-of-file is reached. The
1827
* driver does the necessary conversion from Java character format to
1828
* the national character set in the database.
1829
* @param parameterName the name of the parameter to be set
1830
* @param value the parameter value
1831
* @param length the number of characters in the parameter data.
1832
* @throws SQLException if parameterName does not correspond to a named
1833
* parameter; if the driver does not support national
1834
* character sets; if the driver can detect that a data conversion
1835
* error could occur; if a database access error occurs or
1836
* this method is called on a closed {@code CallableStatement}
1837
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1838
* this method
1839
* @since 1.6
1840
*/
1841
void setNCharacterStream(String parameterName, Reader value, long length)
1842
throws SQLException;
1843
1844
/**
1845
* Sets the designated parameter to a {@code java.sql.NClob} object. The object
1846
* implements the {@code java.sql.NClob} interface. This {@code NClob}
1847
* object maps to a SQL {@code NCLOB}.
1848
* @param parameterName the name of the parameter to be set
1849
* @param value the parameter value
1850
* @throws SQLException if parameterName does not correspond to a named
1851
* parameter; if the driver does not support national
1852
* character sets; if the driver can detect that a data conversion
1853
* error could occur; if a database access error occurs or
1854
* this method is called on a closed {@code CallableStatement}
1855
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1856
* this method
1857
* @since 1.6
1858
*/
1859
void setNClob(String parameterName, NClob value) throws SQLException;
1860
1861
/**
1862
* Sets the designated parameter to a {@code Reader} object. The {@code reader} must contain the number
1863
* of characters specified by length otherwise a {@code SQLException} will be
1864
* generated when the {@code CallableStatement} is executed.
1865
* This method differs from the {@code setCharacterStream (int, Reader, int)} method
1866
* because it informs the driver that the parameter value should be sent to
1867
* the server as a {@code CLOB}. When the {@code setCharacterStream} method is used, the
1868
* driver may have to do extra work to determine whether the parameter
1869
* data should be send to the server as a {@code LONGVARCHAR} or a {@code CLOB}
1870
* @param parameterName the name of the parameter to be set
1871
* @param reader An object that contains the data to set the parameter value to.
1872
* @param length the number of characters in the parameter data.
1873
* @throws SQLException if parameterName does not correspond to a named
1874
* parameter; if the length specified is less than zero;
1875
* a database access error occurs or
1876
* this method is called on a closed {@code CallableStatement}
1877
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1878
* this method
1879
*
1880
* @since 1.6
1881
*/
1882
void setClob(String parameterName, Reader reader, long length)
1883
throws SQLException;
1884
1885
/**
1886
* Sets the designated parameter to an {@code InputStream} object.
1887
* The {@code Inputstream} must contain the number
1888
* of characters specified by length, otherwise a {@code SQLException} will be
1889
* generated when the {@code CallableStatement} is executed.
1890
* This method differs from the {@code setBinaryStream (int, InputStream, int)}
1891
* method because it informs the driver that the parameter value should be
1892
* sent to the server as a {@code BLOB}. When the {@code setBinaryStream} method is used,
1893
* the driver may have to do extra work to determine whether the parameter
1894
* data should be sent to the server as a {@code LONGVARBINARY} or a {@code BLOB}
1895
*
1896
* @param parameterName the name of the parameter to be set
1897
* the second is 2, ...
1898
*
1899
* @param inputStream An object that contains the data to set the parameter
1900
* value to.
1901
* @param length the number of bytes in the parameter data.
1902
* @throws SQLException if parameterName does not correspond to a named
1903
* parameter; if the length specified
1904
* is less than zero; if the number of bytes in the {@code InputStream}
1905
* does not match the specified length; if a database access error occurs or
1906
* this method is called on a closed {@code CallableStatement}
1907
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1908
* this method
1909
*
1910
* @since 1.6
1911
*/
1912
void setBlob(String parameterName, InputStream inputStream, long length)
1913
throws SQLException;
1914
/**
1915
* Sets the designated parameter to a {@code Reader} object. The {@code reader} must contain the number
1916
* of characters specified by length otherwise a {@code SQLException} will be
1917
* generated when the {@code CallableStatement} is executed.
1918
* This method differs from the {@code setCharacterStream (int, Reader, int)} method
1919
* because it informs the driver that the parameter value should be sent to
1920
* the server as a {@code NCLOB}. When the {@code setCharacterStream} method is used, the
1921
* driver may have to do extra work to determine whether the parameter
1922
* data should be send to the server as a {@code LONGNVARCHAR} or a {@code NCLOB}
1923
*
1924
* @param parameterName the name of the parameter to be set
1925
* @param reader An object that contains the data to set the parameter value to.
1926
* @param length the number of characters in the parameter data.
1927
* @throws SQLException if parameterName does not correspond to a named
1928
* parameter; if the length specified is less than zero;
1929
* if the driver does not support national
1930
* character sets; if the driver can detect that a data conversion
1931
* error could occur; if a database access error occurs or
1932
* this method is called on a closed {@code CallableStatement}
1933
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1934
* this method
1935
* @since 1.6
1936
*/
1937
void setNClob(String parameterName, Reader reader, long length)
1938
throws SQLException;
1939
1940
/**
1941
* Retrieves the value of the designated JDBC {@code NCLOB} parameter as a
1942
* {@code java.sql.NClob} object in the Java programming language.
1943
*
1944
* @param parameterIndex the first parameter is 1, the second is 2, and
1945
* so on
1946
* @return the parameter value as a {@code NClob} object in the
1947
* Java programming language. If the value was SQL {@code NULL}, the
1948
* value {@code null} is returned.
1949
* @throws SQLException if the parameterIndex is not valid;
1950
* if the driver does not support national
1951
* character sets; if the driver can detect that a data conversion
1952
* error could occur; if a database access error occurs or
1953
* this method is called on a closed {@code CallableStatement}
1954
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1955
* this method
1956
* @since 1.6
1957
*/
1958
NClob getNClob (int parameterIndex) throws SQLException;
1959
1960
1961
/**
1962
* Retrieves the value of a JDBC {@code NCLOB} parameter as a
1963
* {@code java.sql.NClob} object in the Java programming language.
1964
* @param parameterName the name of the parameter
1965
* @return the parameter value as a {@code NClob} object in the
1966
* Java programming language. If the value was SQL {@code NULL},
1967
* the value {@code null} is returned.
1968
* @throws SQLException if parameterName does not correspond to a named
1969
* parameter; if the driver does not support national
1970
* character sets; if the driver can detect that a data conversion
1971
* error could occur; if a database access error occurs or
1972
* this method is called on a closed {@code CallableStatement}
1973
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1974
* this method
1975
* @since 1.6
1976
*/
1977
NClob getNClob (String parameterName) throws SQLException;
1978
1979
/**
1980
* Sets the designated parameter to the given {@code java.sql.SQLXML} object. The driver converts this to an
1981
* {@code SQL XML} value when it sends it to the database.
1982
*
1983
* @param parameterName the name of the parameter
1984
* @param xmlObject a {@code SQLXML} object that maps an {@code SQL XML} value
1985
* @throws SQLException if parameterName does not correspond to a named
1986
* parameter; if a database access error occurs;
1987
* this method is called on a closed {@code CallableStatement} or
1988
* the {@code java.xml.transform.Result},
1989
* {@code Writer} or {@code OutputStream} has not been closed for the {@code SQLXML} object
1990
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
1991
* this method
1992
*
1993
* @since 1.6
1994
*/
1995
void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException;
1996
1997
/**
1998
* Retrieves the value of the designated {@code SQL XML} parameter as a
1999
* {@code java.sql.SQLXML} object in the Java programming language.
2000
* @param parameterIndex index of the first parameter is 1, the second is 2, ...
2001
* @return a {@code SQLXML} object that maps an {@code SQL XML} value
2002
* @throws SQLException if the parameterIndex is not valid;
2003
* if a database access error occurs or
2004
* this method is called on a closed {@code CallableStatement}
2005
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2006
* this method
2007
* @since 1.6
2008
*/
2009
SQLXML getSQLXML(int parameterIndex) throws SQLException;
2010
2011
/**
2012
* Retrieves the value of the designated {@code SQL XML} parameter as a
2013
* {@code java.sql.SQLXML} object in the Java programming language.
2014
* @param parameterName the name of the parameter
2015
* @return a {@code SQLXML} object that maps an {@code SQL XML} value
2016
* @throws SQLException if parameterName does not correspond to a named
2017
* parameter; if a database access error occurs or
2018
* this method is called on a closed {@code CallableStatement}
2019
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2020
* this method
2021
* @since 1.6
2022
*/
2023
SQLXML getSQLXML(String parameterName) throws SQLException;
2024
2025
/**
2026
* Retrieves the value of the designated {@code NCHAR},
2027
* {@code NVARCHAR}
2028
* or {@code LONGNVARCHAR} parameter as
2029
* a {@code String} in the Java programming language.
2030
* <p>
2031
* For the fixed-length type JDBC {@code NCHAR},
2032
* the {@code String} object
2033
* returned has exactly the same value the SQL
2034
* {@code NCHAR} value had in the
2035
* database, including any padding added by the database.
2036
*
2037
* @param parameterIndex index of the first parameter is 1, the second is 2, ...
2038
* @return a {@code String} object that maps an
2039
* {@code NCHAR}, {@code NVARCHAR} or {@code LONGNVARCHAR} value
2040
* @throws SQLException if the parameterIndex is not valid;
2041
* if a database access error occurs or
2042
* this method is called on a closed {@code CallableStatement}
2043
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2044
* this method
2045
* @since 1.6
2046
* @see #setNString
2047
*/
2048
String getNString(int parameterIndex) throws SQLException;
2049
2050
2051
/**
2052
* Retrieves the value of the designated {@code NCHAR},
2053
* {@code NVARCHAR}
2054
* or {@code LONGNVARCHAR} parameter as
2055
* a {@code String} in the Java programming language.
2056
* <p>
2057
* For the fixed-length type JDBC {@code NCHAR},
2058
* the {@code String} object
2059
* returned has exactly the same value the SQL
2060
* {@code NCHAR} value had in the
2061
* database, including any padding added by the database.
2062
*
2063
* @param parameterName the name of the parameter
2064
* @return a {@code String} object that maps an
2065
* {@code NCHAR}, {@code NVARCHAR} or {@code LONGNVARCHAR} value
2066
* @throws SQLException if parameterName does not correspond to a named
2067
* parameter;
2068
* if a database access error occurs or
2069
* this method is called on a closed {@code CallableStatement}
2070
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2071
* this method
2072
* @since 1.6
2073
* @see #setNString
2074
*/
2075
String getNString(String parameterName) throws SQLException;
2076
2077
/**
2078
* Retrieves the value of the designated parameter as a
2079
* {@code java.io.Reader} object in the Java programming language.
2080
* It is intended for use when
2081
* accessing {@code NCHAR},{@code NVARCHAR}
2082
* and {@code LONGNVARCHAR} parameters.
2083
*
2084
* @return a {@code java.io.Reader} object that contains the parameter
2085
* value; if the value is SQL {@code NULL}, the value returned is
2086
* {@code null} in the Java programming language.
2087
* @param parameterIndex the first parameter is 1, the second is 2, ...
2088
* @throws SQLException if the parameterIndex is not valid;
2089
* if a database access error occurs or
2090
* this method is called on a closed {@code CallableStatement}
2091
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2092
* this method
2093
* @since 1.6
2094
*/
2095
java.io.Reader getNCharacterStream(int parameterIndex) throws SQLException;
2096
2097
/**
2098
* Retrieves the value of the designated parameter as a
2099
* {@code java.io.Reader} object in the Java programming language.
2100
* It is intended for use when
2101
* accessing {@code NCHAR},{@code NVARCHAR}
2102
* and {@code LONGNVARCHAR} parameters.
2103
*
2104
* @param parameterName the name of the parameter
2105
* @return a {@code java.io.Reader} object that contains the parameter
2106
* value; if the value is SQL {@code NULL}, the value returned is
2107
* {@code null} in the Java programming language
2108
* @throws SQLException if parameterName does not correspond to a named
2109
* parameter; if a database access error occurs or
2110
* this method is called on a closed {@code CallableStatement}
2111
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2112
* this method
2113
* @since 1.6
2114
*/
2115
java.io.Reader getNCharacterStream(String parameterName) throws SQLException;
2116
2117
/**
2118
* Retrieves the value of the designated parameter as a
2119
* {@code java.io.Reader} object in the Java programming language.
2120
*
2121
* @return a {@code java.io.Reader} object that contains the parameter
2122
* value; if the value is SQL {@code NULL}, the value returned is
2123
* {@code null} in the Java programming language.
2124
* @param parameterIndex the first parameter is 1, the second is 2, ...
2125
* @throws SQLException if the parameterIndex is not valid; if a database access error occurs or
2126
* this method is called on a closed {@code CallableStatement}
2127
* @since 1.6
2128
*/
2129
java.io.Reader getCharacterStream(int parameterIndex) throws SQLException;
2130
2131
/**
2132
* Retrieves the value of the designated parameter as a
2133
* {@code java.io.Reader} object in the Java programming language.
2134
*
2135
* @param parameterName the name of the parameter
2136
* @return a {@code java.io.Reader} object that contains the parameter
2137
* value; if the value is SQL {@code NULL}, the value returned is
2138
* {@code null} in the Java programming language
2139
* @throws SQLException if parameterName does not correspond to a named
2140
* parameter; if a database access error occurs or
2141
* this method is called on a closed {@code CallableStatement}
2142
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2143
* this method
2144
* @since 1.6
2145
*/
2146
java.io.Reader getCharacterStream(String parameterName) throws SQLException;
2147
2148
/**
2149
* Sets the designated parameter to the given {@code java.sql.Blob} object.
2150
* The driver converts this to an SQL {@code BLOB} value when it
2151
* sends it to the database.
2152
*
2153
* @param parameterName the name of the parameter
2154
* @param x a {@code Blob} object that maps an SQL {@code BLOB} value
2155
* @throws SQLException if parameterName does not correspond to a named
2156
* parameter; if a database access error occurs or
2157
* this method is called on a closed {@code CallableStatement}
2158
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2159
* this method
2160
* @since 1.6
2161
*/
2162
void setBlob (String parameterName, Blob x) throws SQLException;
2163
2164
/**
2165
* Sets the designated parameter to the given {@code java.sql.Clob} object.
2166
* The driver converts this to an SQL {@code CLOB} value when it
2167
* sends it to the database.
2168
*
2169
* @param parameterName the name of the parameter
2170
* @param x a {@code Clob} object that maps an SQL {@code CLOB} value
2171
* @throws SQLException if parameterName does not correspond to a named
2172
* parameter; if a database access error occurs or
2173
* this method is called on a closed {@code CallableStatement}
2174
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2175
* this method
2176
* @since 1.6
2177
*/
2178
void setClob (String parameterName, Clob x) throws SQLException;
2179
/**
2180
* Sets the designated parameter to the given input stream, which will have
2181
* the specified number of bytes.
2182
* When a very large ASCII value is input to a {@code LONGVARCHAR}
2183
* parameter, it may be more practical to send it via a
2184
* {@code java.io.InputStream}. Data will be read from the stream
2185
* as needed until end-of-file is reached. The JDBC driver will
2186
* do any necessary conversion from ASCII to the database char format.
2187
*
2188
* <P><B>Note:</B> This stream object can either be a standard
2189
* Java stream object or your own subclass that implements the
2190
* standard interface.
2191
*
2192
* @param parameterName the name of the parameter
2193
* @param x the Java input stream that contains the ASCII parameter value
2194
* @param length the number of bytes in the stream
2195
* @throws SQLException if parameterName does not correspond to a named
2196
* parameter; if a database access error occurs or
2197
* this method is called on a closed {@code CallableStatement}
2198
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2199
* this method
2200
* @since 1.6
2201
*/
2202
void setAsciiStream(String parameterName, java.io.InputStream x, long length)
2203
throws SQLException;
2204
2205
/**
2206
* Sets the designated parameter to the given input stream, which will have
2207
* the specified number of bytes.
2208
* When a very large binary value is input to a {@code LONGVARBINARY}
2209
* parameter, it may be more practical to send it via a
2210
* {@code java.io.InputStream} object. The data will be read from the stream
2211
* as needed until end-of-file is reached.
2212
*
2213
* <P><B>Note:</B> This stream object can either be a standard
2214
* Java stream object or your own subclass that implements the
2215
* standard interface.
2216
*
2217
* @param parameterName the name of the parameter
2218
* @param x the java input stream which contains the binary parameter value
2219
* @param length the number of bytes in the stream
2220
* @throws SQLException if parameterName does not correspond to a named
2221
* parameter; if a database access error occurs or
2222
* this method is called on a closed {@code CallableStatement}
2223
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2224
* this method
2225
* @since 1.6
2226
*/
2227
void setBinaryStream(String parameterName, java.io.InputStream x,
2228
long length) throws SQLException;
2229
/**
2230
* Sets the designated parameter to the given {@code Reader}
2231
* object, which is the given number of characters long.
2232
* When a very large UNICODE value is input to a {@code LONGVARCHAR}
2233
* parameter, it may be more practical to send it via a
2234
* {@code java.io.Reader} object. The data will be read from the stream
2235
* as needed until end-of-file is reached. The JDBC driver will
2236
* do any necessary conversion from UNICODE to the database char format.
2237
*
2238
* <P><B>Note:</B> This stream object can either be a standard
2239
* Java stream object or your own subclass that implements the
2240
* standard interface.
2241
*
2242
* @param parameterName the name of the parameter
2243
* @param reader the {@code java.io.Reader} object that
2244
* contains the UNICODE data used as the designated parameter
2245
* @param length the number of characters in the stream
2246
* @throws SQLException if parameterName does not correspond to a named
2247
* parameter; if a database access error occurs or
2248
* this method is called on a closed {@code CallableStatement}
2249
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2250
* this method
2251
* @since 1.6
2252
*/
2253
void setCharacterStream(String parameterName,
2254
java.io.Reader reader,
2255
long length) throws SQLException;
2256
//--
2257
/**
2258
* Sets the designated parameter to the given input stream.
2259
* When a very large ASCII value is input to a {@code LONGVARCHAR}
2260
* parameter, it may be more practical to send it via a
2261
* {@code java.io.InputStream}. Data will be read from the stream
2262
* as needed until end-of-file is reached. The JDBC driver will
2263
* do any necessary conversion from ASCII to the database char format.
2264
*
2265
* <P><B>Note:</B> This stream object can either be a standard
2266
* Java stream object or your own subclass that implements the
2267
* standard interface.
2268
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2269
* it might be more efficient to use a version of
2270
* {@code setAsciiStream} which takes a length parameter.
2271
*
2272
* @param parameterName the name of the parameter
2273
* @param x the Java input stream that contains the ASCII parameter value
2274
* @throws SQLException if parameterName does not correspond to a named
2275
* parameter; if a database access error occurs or
2276
* this method is called on a closed {@code CallableStatement}
2277
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2278
* @since 1.6
2279
*/
2280
void setAsciiStream(String parameterName, java.io.InputStream x)
2281
throws SQLException;
2282
/**
2283
* Sets the designated parameter to the given input stream.
2284
* When a very large binary value is input to a {@code LONGVARBINARY}
2285
* parameter, it may be more practical to send it via a
2286
* {@code java.io.InputStream} object. The data will be read from the
2287
* stream as needed until end-of-file is reached.
2288
*
2289
* <P><B>Note:</B> This stream object can either be a standard
2290
* Java stream object or your own subclass that implements the
2291
* standard interface.
2292
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2293
* it might be more efficient to use a version of
2294
* {@code setBinaryStream} which takes a length parameter.
2295
*
2296
* @param parameterName the name of the parameter
2297
* @param x the java input stream which contains the binary parameter value
2298
* @throws SQLException if parameterName does not correspond to a named
2299
* parameter; if a database access error occurs or
2300
* this method is called on a closed {@code CallableStatement}
2301
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2302
* @since 1.6
2303
*/
2304
void setBinaryStream(String parameterName, java.io.InputStream x)
2305
throws SQLException;
2306
/**
2307
* Sets the designated parameter to the given {@code Reader}
2308
* object.
2309
* When a very large UNICODE value is input to a {@code LONGVARCHAR}
2310
* parameter, it may be more practical to send it via a
2311
* {@code java.io.Reader} object. The data will be read from the stream
2312
* as needed until end-of-file is reached. The JDBC driver will
2313
* do any necessary conversion from UNICODE to the database char format.
2314
*
2315
* <P><B>Note:</B> This stream object can either be a standard
2316
* Java stream object or your own subclass that implements the
2317
* standard interface.
2318
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2319
* it might be more efficient to use a version of
2320
* {@code setCharacterStream} which takes a length parameter.
2321
*
2322
* @param parameterName the name of the parameter
2323
* @param reader the {@code java.io.Reader} object that contains the
2324
* Unicode data
2325
* @throws SQLException if parameterName does not correspond to a named
2326
* parameter; if a database access error occurs or
2327
* this method is called on a closed {@code CallableStatement}
2328
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2329
* @since 1.6
2330
*/
2331
void setCharacterStream(String parameterName,
2332
java.io.Reader reader) throws SQLException;
2333
/**
2334
* Sets the designated parameter to a {@code Reader} object. The
2335
* {@code Reader} reads the data till end-of-file is reached. The
2336
* driver does the necessary conversion from Java character format to
2337
* the national character set in the database.
2338
2339
* <P><B>Note:</B> This stream object can either be a standard
2340
* Java stream object or your own subclass that implements the
2341
* standard interface.
2342
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2343
* it might be more efficient to use a version of
2344
* {@code setNCharacterStream} which takes a length parameter.
2345
*
2346
* @param parameterName the name of the parameter
2347
* @param value the parameter value
2348
* @throws SQLException if parameterName does not correspond to a named
2349
* parameter; if the driver does not support national
2350
* character sets; if the driver can detect that a data conversion
2351
* error could occur; if a database access error occurs; or
2352
* this method is called on a closed {@code CallableStatement}
2353
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2354
* @since 1.6
2355
*/
2356
void setNCharacterStream(String parameterName, Reader value) throws SQLException;
2357
2358
/**
2359
* Sets the designated parameter to a {@code Reader} object.
2360
* This method differs from the {@code setCharacterStream (int, Reader)} method
2361
* because it informs the driver that the parameter value should be sent to
2362
* the server as a {@code CLOB}. When the {@code setCharacterStream} method is used, the
2363
* driver may have to do extra work to determine whether the parameter
2364
* data should be send to the server as a {@code LONGVARCHAR} or a {@code CLOB}
2365
*
2366
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2367
* it might be more efficient to use a version of
2368
* {@code setClob} which takes a length parameter.
2369
*
2370
* @param parameterName the name of the parameter
2371
* @param reader An object that contains the data to set the parameter value to.
2372
* @throws SQLException if parameterName does not correspond to a named
2373
* parameter; if a database access error occurs or this method is called on
2374
* a closed {@code CallableStatement}
2375
*
2376
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2377
* @since 1.6
2378
*/
2379
void setClob(String parameterName, Reader reader)
2380
throws SQLException;
2381
2382
/**
2383
* Sets the designated parameter to an {@code InputStream} object.
2384
* This method differs from the {@code setBinaryStream (int, InputStream)}
2385
* method because it informs the driver that the parameter value should be
2386
* sent to the server as a {@code BLOB}. When the {@code setBinaryStream} method is used,
2387
* the driver may have to do extra work to determine whether the parameter
2388
* data should be send to the server as a {@code LONGVARBINARY} or a {@code BLOB}
2389
*
2390
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2391
* it might be more efficient to use a version of
2392
* {@code setBlob} which takes a length parameter.
2393
*
2394
* @param parameterName the name of the parameter
2395
* @param inputStream An object that contains the data to set the parameter
2396
* value to.
2397
* @throws SQLException if parameterName does not correspond to a named
2398
* parameter; if a database access error occurs or
2399
* this method is called on a closed {@code CallableStatement}
2400
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2401
*
2402
* @since 1.6
2403
*/
2404
void setBlob(String parameterName, InputStream inputStream)
2405
throws SQLException;
2406
/**
2407
* Sets the designated parameter to a {@code Reader} object.
2408
* This method differs from the {@code setCharacterStream (int, Reader)} method
2409
* because it informs the driver that the parameter value should be sent to
2410
* the server as a {@code NCLOB}. When the {@code setCharacterStream} method is used, the
2411
* driver may have to do extra work to determine whether the parameter
2412
* data should be send to the server as a {@code LONGNVARCHAR} or a {@code NCLOB}
2413
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if
2414
* it might be more efficient to use a version of
2415
* {@code setNClob} which takes a length parameter.
2416
*
2417
* @param parameterName the name of the parameter
2418
* @param reader An object that contains the data to set the parameter value to.
2419
* @throws SQLException if parameterName does not correspond to a named
2420
* parameter; if the driver does not support national character sets;
2421
* if the driver can detect that a data conversion
2422
* error could occur; if a database access error occurs or
2423
* this method is called on a closed {@code CallableStatement}
2424
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2425
*
2426
* @since 1.6
2427
*/
2428
void setNClob(String parameterName, Reader reader)
2429
throws SQLException;
2430
2431
//------------------------- JDBC 4.1 -----------------------------------
2432
2433
2434
/**
2435
* Returns an object representing the value of OUT parameter
2436
* {@code parameterIndex} and will convert from the
2437
* SQL type of the parameter to the requested Java data type, if the
2438
* conversion is supported. If the conversion is not
2439
* supported or null is specified for the type, a
2440
* {@code SQLException} is thrown.
2441
*<p>
2442
* At a minimum, an implementation must support the conversions defined in
2443
* Appendix B, Table B-3 and conversion of appropriate user defined SQL
2444
* types to a Java type which implements {@code SQLData}, or {@code Struct}.
2445
* Additional conversions may be supported and are vendor defined.
2446
*
2447
* @param parameterIndex the first parameter is 1, the second is 2, and so on
2448
* @param type Class representing the Java data type to convert the
2449
* designated parameter to.
2450
* @param <T> the type of the class modeled by this Class object
2451
* @return an instance of {@code type} holding the OUT parameter value
2452
* @throws SQLException if conversion is not supported, type is null or
2453
* another error occurs. The getCause() method of the
2454
* exception may provide a more detailed exception, for example, if
2455
* a conversion error occurs
2456
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2457
* this method
2458
* @since 1.7
2459
*/
2460
public <T> T getObject(int parameterIndex, Class<T> type) throws SQLException;
2461
2462
2463
/**
2464
* Returns an object representing the value of OUT parameter
2465
* {@code parameterName} and will convert from the
2466
* SQL type of the parameter to the requested Java data type, if the
2467
* conversion is supported. If the conversion is not
2468
* supported or null is specified for the type, a
2469
* {@code SQLException} is thrown.
2470
*<p>
2471
* At a minimum, an implementation must support the conversions defined in
2472
* Appendix B, Table B-3 and conversion of appropriate user defined SQL
2473
* types to a Java type which implements {@code SQLData}, or {@code Struct}.
2474
* Additional conversions may be supported and are vendor defined.
2475
*
2476
* @param parameterName the name of the parameter
2477
* @param type Class representing the Java data type to convert
2478
* the designated parameter to.
2479
* @param <T> the type of the class modeled by this Class object
2480
* @return an instance of {@code type} holding the OUT parameter
2481
* value
2482
* @throws SQLException if conversion is not supported, type is null or
2483
* another error occurs. The getCause() method of the
2484
* exception may provide a more detailed exception, for example, if
2485
* a conversion error occurs
2486
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
2487
* this method
2488
* @since 1.7
2489
*/
2490
public <T> T getObject(String parameterName, Class<T> type) throws SQLException;
2491
2492
//------------------------- JDBC 4.2 -----------------------------------
2493
2494
/**
2495
* Sets the value of the designated parameter with the given object.
2496
*
2497
* If the second argument is an {@code InputStream} then the stream
2498
* must contain the number of bytes specified by scaleOrLength.
2499
* If the second argument is a {@code Reader} then the reader must
2500
* contain the number of characters specified
2501
* by scaleOrLength. If these conditions are not true the driver
2502
* will generate a
2503
* {@code SQLException} when the prepared statement is executed.
2504
*
2505
* <p>The given Java object will be converted to the given targetSqlType
2506
* before being sent to the database.
2507
*
2508
* If the object has a custom mapping (is of a class implementing the
2509
* interface {@code SQLData}),
2510
* the JDBC driver should call the method {@code SQLData.writeSQL} to
2511
* write it to the SQL data stream.
2512
* If, on the other hand, the object is of a class implementing
2513
* {@code Ref}, {@code Blob}, {@code Clob}, {@code NClob},
2514
* {@code Struct}, {@code java.net.URL},
2515
* or {@code Array}, the driver should pass it to the database as a
2516
* value of the corresponding SQL type.
2517
*
2518
* <p>Note that this method may be used to pass database-specific
2519
* abstract data types.
2520
*<P>
2521
* The default implementation will throw {@code SQLFeatureNotSupportedException}
2522
*
2523
* @param parameterName the name of the parameter
2524
* @param x the object containing the input parameter value
2525
* @param targetSqlType the SQL type to be
2526
* sent to the database. The scale argument may further qualify this type.
2527
* @param scaleOrLength for {@code java.sql.JDBCType.DECIMAL}
2528
* or {@code java.sql.JDBCType.NUMERIC types},
2529
* this is the number of digits after the decimal point. For
2530
* Java Object types {@code InputStream} and {@code Reader},
2531
* this is the length
2532
* of the data in the stream or reader. For all other types,
2533
* this value will be ignored.
2534
* @throws SQLException if parameterName does not correspond to a named
2535
* parameter; if a database access error occurs
2536
* or this method is called on a closed {@code CallableStatement} or
2537
* if the Java Object specified by x is an InputStream
2538
* or Reader object and the value of the scale parameter is less
2539
* than zero
2540
* @throws SQLFeatureNotSupportedException if
2541
* the JDBC driver does not support the specified targetSqlType
2542
* @see JDBCType
2543
* @see SQLType
2544
*
2545
* @since 1.8
2546
*/
2547
default void setObject(String parameterName, Object x, SQLType targetSqlType,
2548
int scaleOrLength) throws SQLException {
2549
throw new SQLFeatureNotSupportedException("setObject not implemented");
2550
}
2551
/**
2552
* Sets the value of the designated parameter with the given object.
2553
*
2554
* This method is similar to {@link #setObject(String parameterName,
2555
* Object x, SQLType targetSqlType, int scaleOrLength)},
2556
* except that it assumes a scale of zero.
2557
*<P>
2558
* The default implementation will throw {@code SQLFeatureNotSupportedException}
2559
*
2560
* @param parameterName the name of the parameter
2561
* @param x the object containing the input parameter value
2562
* @param targetSqlType the SQL type to be sent to the database
2563
* @throws SQLException if parameterName does not correspond to a named
2564
* parameter; if a database access error occurs
2565
* or this method is called on a closed {@code CallableStatement}
2566
* @throws SQLFeatureNotSupportedException if
2567
* the JDBC driver does not support the specified targetSqlType
2568
* @see JDBCType
2569
* @see SQLType
2570
* @since 1.8
2571
*/
2572
default void setObject(String parameterName, Object x, SQLType targetSqlType)
2573
throws SQLException {
2574
throw new SQLFeatureNotSupportedException("setObject not implemented");
2575
}
2576
2577
/**
2578
* Registers the OUT parameter in ordinal position
2579
* {@code parameterIndex} to the JDBC type
2580
* {@code sqlType}. All OUT parameters must be registered
2581
* before a stored procedure is executed.
2582
* <p>
2583
* The JDBC type specified by {@code sqlType} for an OUT
2584
* parameter determines the Java type that must be used
2585
* in the {@code get} method to read the value of that parameter.
2586
* <p>
2587
* If the JDBC type expected to be returned to this output parameter
2588
* is specific to this particular database, {@code sqlType}
2589
* may be {@code JDBCType.OTHER} or a {@code SQLType} that is supported by
2590
* the JDBC driver. The method
2591
* {@link #getObject} retrieves the value.
2592
*<P>
2593
* The default implementation will throw {@code SQLFeatureNotSupportedException}
2594
*
2595
* @param parameterIndex the first parameter is 1, the second is 2,
2596
* and so on
2597
* @param sqlType the JDBC type code defined by {@code SQLType} to use to
2598
* register the OUT Parameter.
2599
* If the parameter is of JDBC type {@code JDBCType.NUMERIC}
2600
* or {@code JDBCType.DECIMAL}, the version of
2601
* {@code registerOutParameter} that accepts a scale value
2602
* should be used.
2603
*
2604
* @throws SQLException if the parameterIndex is not valid;
2605
* if a database access error occurs or
2606
* this method is called on a closed {@code CallableStatement}
2607
* @throws SQLFeatureNotSupportedException if
2608
* the JDBC driver does not support the specified sqlType
2609
* @see JDBCType
2610
* @see SQLType
2611
* @since 1.8
2612
*/
2613
default void registerOutParameter(int parameterIndex, SQLType sqlType)
2614
throws SQLException {
2615
throw new SQLFeatureNotSupportedException("registerOutParameter not implemented");
2616
}
2617
2618
/**
2619
* Registers the parameter in ordinal position
2620
* {@code parameterIndex} to be of JDBC type
2621
* {@code sqlType}. All OUT parameters must be registered
2622
* before a stored procedure is executed.
2623
* <p>
2624
* The JDBC type specified by {@code sqlType} for an OUT
2625
* parameter determines the Java type that must be used
2626
* in the {@code get} method to read the value of that parameter.
2627
* <p>
2628
* This version of {@code registerOutParameter} should be
2629
* used when the parameter is of JDBC type {@code JDBCType.NUMERIC}
2630
* or {@code JDBCType.DECIMAL}.
2631
*<P>
2632
* The default implementation will throw {@code SQLFeatureNotSupportedException}
2633
*
2634
* @param parameterIndex the first parameter is 1, the second is 2,
2635
* and so on
2636
* @param sqlType the JDBC type code defined by {@code SQLType} to use to
2637
* register the OUT Parameter.
2638
* @param scale the desired number of digits to the right of the
2639
* decimal point. It must be greater than or equal to zero.
2640
* @throws SQLException if the parameterIndex is not valid;
2641
* if a database access error occurs or
2642
* this method is called on a closed {@code CallableStatement}
2643
* @throws SQLFeatureNotSupportedException if
2644
* the JDBC driver does not support the specified sqlType
2645
* @see JDBCType
2646
* @see SQLType
2647
* @since 1.8
2648
*/
2649
default void registerOutParameter(int parameterIndex, SQLType sqlType,
2650
int scale) throws SQLException {
2651
throw new SQLFeatureNotSupportedException("registerOutParameter not implemented");
2652
}
2653
/**
2654
* Registers the designated output parameter.
2655
* This version of
2656
* the method {@code registerOutParameter}
2657
* should be used for a user-defined or {@code REF} output parameter.
2658
* Examples
2659
* of user-defined types include: {@code STRUCT}, {@code DISTINCT},
2660
* {@code JAVA_OBJECT}, and named array types.
2661
*<p>
2662
* All OUT parameters must be registered
2663
* before a stored procedure is executed.
2664
* <p> For a user-defined parameter, the fully-qualified SQL
2665
* type name of the parameter should also be given, while a {@code REF}
2666
* parameter requires that the fully-qualified type name of the
2667
* referenced type be given. A JDBC driver that does not need the
2668
* type code and type name information may ignore it. To be portable,
2669
* however, applications should always provide these values for
2670
* user-defined and {@code REF} parameters.
2671
*
2672
* Although it is intended for user-defined and {@code REF} parameters,
2673
* this method may be used to register a parameter of any JDBC type.
2674
* If the parameter does not have a user-defined or {@code REF} type, the
2675
* <i>typeName</i> parameter is ignored.
2676
*
2677
* <P><B>Note:</B> When reading the value of an out parameter, you
2678
* must use the getter method whose Java type corresponds to the
2679
* parameter's registered SQL type.
2680
*<P>
2681
* The default implementation will throw {@code SQLFeatureNotSupportedException}
2682
*
2683
* @param parameterIndex the first parameter is 1, the second is 2,...
2684
* @param sqlType the JDBC type code defined by {@code SQLType} to use to
2685
* register the OUT Parameter.
2686
* @param typeName the fully-qualified name of an SQL structured type
2687
* @throws SQLException if the parameterIndex is not valid;
2688
* if a database access error occurs or
2689
* this method is called on a closed {@code CallableStatement}
2690
* @throws SQLFeatureNotSupportedException if
2691
* the JDBC driver does not support the specified sqlType
2692
* @see JDBCType
2693
* @see SQLType
2694
* @since 1.8
2695
*/
2696
default void registerOutParameter (int parameterIndex, SQLType sqlType,
2697
String typeName) throws SQLException {
2698
throw new SQLFeatureNotSupportedException("registerOutParameter not implemented");
2699
}
2700
2701
/**
2702
* Registers the OUT parameter named
2703
* {@code parameterName} to the JDBC type
2704
* {@code sqlType}. All OUT parameters must be registered
2705
* before a stored procedure is executed.
2706
* <p>
2707
* The JDBC type specified by {@code sqlType} for an OUT
2708
* parameter determines the Java type that must be used
2709
* in the {@code get} method to read the value of that parameter.
2710
* <p>
2711
* If the JDBC type expected to be returned to this output parameter
2712
* is specific to this particular database, {@code sqlType}
2713
* should be {@code JDBCType.OTHER} or a {@code SQLType} that is supported
2714
* by the JDBC driver.. The method
2715
* {@link #getObject} retrieves the value.
2716
*<P>
2717
* The default implementation will throw {@code SQLFeatureNotSupportedException}
2718
*
2719
* @param parameterName the name of the parameter
2720
* @param sqlType the JDBC type code defined by {@code SQLType} to use to
2721
* register the OUT Parameter.
2722
* If the parameter is of JDBC type {@code JDBCType.NUMERIC}
2723
* or {@code JDBCType.DECIMAL}, the version of
2724
* {@code registerOutParameter} that accepts a scale value
2725
* should be used.
2726
* @throws SQLException if parameterName does not correspond to a named
2727
* parameter; if a database access error occurs or
2728
* this method is called on a closed {@code CallableStatement}
2729
* @throws SQLFeatureNotSupportedException if
2730
* the JDBC driver does not support the specified sqlType
2731
* or if the JDBC driver does not support
2732
* this method
2733
* @since 1.8
2734
* @see JDBCType
2735
* @see SQLType
2736
*/
2737
default void registerOutParameter(String parameterName, SQLType sqlType)
2738
throws SQLException {
2739
throw new SQLFeatureNotSupportedException("registerOutParameter not implemented");
2740
}
2741
2742
/**
2743
* Registers the parameter named
2744
* {@code parameterName} to be of JDBC type
2745
* {@code sqlType}. All OUT parameters must be registered
2746
* before a stored procedure is executed.
2747
* <p>
2748
* The JDBC type specified by {@code sqlType} for an OUT
2749
* parameter determines the Java type that must be used
2750
* in the {@code get} method to read the value of that parameter.
2751
* <p>
2752
* This version of {@code registerOutParameter} should be
2753
* used when the parameter is of JDBC type {@code JDBCType.NUMERIC}
2754
* or {@code JDBCType.DECIMAL}.
2755
*<P>
2756
* The default implementation will throw {@code SQLFeatureNotSupportedException}
2757
*
2758
* @param parameterName the name of the parameter
2759
* @param sqlType the JDBC type code defined by {@code SQLType} to use to
2760
* register the OUT Parameter.
2761
* @param scale the desired number of digits to the right of the
2762
* decimal point. It must be greater than or equal to zero.
2763
* @throws SQLException if parameterName does not correspond to a named
2764
* parameter; if a database access error occurs or
2765
* this method is called on a closed {@code CallableStatement}
2766
* @throws SQLFeatureNotSupportedException if
2767
* the JDBC driver does not support the specified sqlType
2768
* or if the JDBC driver does not support
2769
* this method
2770
* @since 1.8
2771
* @see JDBCType
2772
* @see SQLType
2773
*/
2774
default void registerOutParameter(String parameterName, SQLType sqlType,
2775
int scale) throws SQLException {
2776
throw new SQLFeatureNotSupportedException("registerOutParameter not implemented");
2777
}
2778
2779
/**
2780
* Registers the designated output parameter. This version of
2781
* the method {@code registerOutParameter}
2782
* should be used for a user-named or REF output parameter. Examples
2783
* of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
2784
* named array types.
2785
*<p>
2786
* All OUT parameters must be registered
2787
* before a stored procedure is executed.
2788
* </p>
2789
* For a user-named parameter the fully-qualified SQL
2790
* type name of the parameter should also be given, while a REF
2791
* parameter requires that the fully-qualified type name of the
2792
* referenced type be given. A JDBC driver that does not need the
2793
* type code and type name information may ignore it. To be portable,
2794
* however, applications should always provide these values for
2795
* user-named and REF parameters.
2796
*
2797
* Although it is intended for user-named and REF parameters,
2798
* this method may be used to register a parameter of any JDBC type.
2799
* If the parameter does not have a user-named or REF type, the
2800
* typeName parameter is ignored.
2801
*
2802
* <P><B>Note:</B> When reading the value of an out parameter, you
2803
* must use the {@code getXXX} method whose Java type XXX corresponds to the
2804
* parameter's registered SQL type.
2805
*<P>
2806
* The default implementation will throw {@code SQLFeatureNotSupportedException}
2807
*
2808
* @param parameterName the name of the parameter
2809
* @param sqlType the JDBC type code defined by {@code SQLType} to use to
2810
* register the OUT Parameter.
2811
* @param typeName the fully-qualified name of an SQL structured type
2812
* @throws SQLException if parameterName does not correspond to a named
2813
* parameter; if a database access error occurs or
2814
* this method is called on a closed {@code CallableStatement}
2815
* @throws SQLFeatureNotSupportedException if
2816
* the JDBC driver does not support the specified sqlType
2817
* or if the JDBC driver does not support this method
2818
* @see JDBCType
2819
* @see SQLType
2820
* @since 1.8
2821
*/
2822
default void registerOutParameter (String parameterName, SQLType sqlType,
2823
String typeName) throws SQLException {
2824
throw new SQLFeatureNotSupportedException("registerOutParameter not implemented");
2825
}
2826
}
2827
2828