1. /*
  2. * @(#)CallableStatement.java 1.47 04/05/18
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package java.sql;
  8. import java.math.BigDecimal;
  9. import java.util.Calendar;
  10. /**
  11. * The interface used to execute SQL stored procedures. The JDBC API
  12. * provides a stored procedure SQL escape syntax that allows stored procedures
  13. * to be called in a standard way for all RDBMSs. This escape syntax has one
  14. * form that includes a result parameter and one that does not. If used, the result
  15. * parameter must be registered as an OUT parameter. The other parameters
  16. * can be used for input, output or both. Parameters are referred to
  17. * sequentially, by number, with the first parameter being 1.
  18. * <PRE>
  19. * {?= call <procedure-name>[<arg1>,<arg2>, ...]}
  20. * {call <procedure-name>[<arg1>,<arg2>, ...]}
  21. * </PRE>
  22. * <P>
  23. * IN parameter values are set using the <code>set</code> methods inherited from
  24. * {@link PreparedStatement}. The type of all OUT parameters must be
  25. * registered prior to executing the stored procedure; their values
  26. * are retrieved after execution via the <code>get</code> methods provided here.
  27. * <P>
  28. * A <code>CallableStatement</code> can return one {@link ResultSet} object or
  29. * multiple <code>ResultSet</code> objects. Multiple
  30. * <code>ResultSet</code> objects are handled using operations
  31. * inherited from {@link Statement}.
  32. * <P>
  33. * For maximum portability, a call's <code>ResultSet</code> objects and
  34. * update counts should be processed prior to getting the values of output
  35. * parameters.
  36. * <P>
  37. *
  38. * @see Connection#prepareCall
  39. * @see ResultSet
  40. */
  41. public interface CallableStatement extends PreparedStatement {
  42. /**
  43. * Registers the OUT parameter in ordinal position
  44. * <code>parameterIndex</code> to the JDBC type
  45. * <code>sqlType</code>. All OUT parameters must be registered
  46. * before a stored procedure is executed.
  47. * <p>
  48. * The JDBC type specified by <code>sqlType</code> for an OUT
  49. * parameter determines the Java type that must be used
  50. * in the <code>get</code> method to read the value of that parameter.
  51. * <p>
  52. * If the JDBC type expected to be returned to this output parameter
  53. * is specific to this particular database, <code>sqlType</code>
  54. * should be <code>java.sql.Types.OTHER</code>. The method
  55. * {@link #getObject} retrieves the value.
  56. *
  57. * @param parameterIndex the first parameter is 1, the second is 2,
  58. * and so on
  59. * @param sqlType the JDBC type code defined by <code>java.sql.Types</code>.
  60. * If the parameter is of JDBC type <code>NUMERIC</code>
  61. * or <code>DECIMAL</code>, the version of
  62. * <code>registerOutParameter</code> that accepts a scale value
  63. * should be used.
  64. *
  65. * @exception SQLException if a database access error occurs
  66. * @see Types
  67. */
  68. void registerOutParameter(int parameterIndex, int sqlType)
  69. throws SQLException;
  70. /**
  71. * Registers the parameter in ordinal position
  72. * <code>parameterIndex</code> to be of JDBC type
  73. * <code>sqlType</code>. This method must be called
  74. * before a stored procedure is executed.
  75. * <p>
  76. * The JDBC type specified by <code>sqlType</code> for an OUT
  77. * parameter determines the Java type that must be used
  78. * in the <code>get</code> method to read the value of that parameter.
  79. * <p>
  80. * This version of <code>registerOutParameter</code> should be
  81. * used when the parameter is of JDBC type <code>NUMERIC</code>
  82. * or <code>DECIMAL</code>.
  83. *
  84. * @param parameterIndex the first parameter is 1, the second is 2,
  85. * and so on
  86. * @param sqlType the SQL type code defined by <code>java.sql.Types</code>.
  87. * @param scale the desired number of digits to the right of the
  88. * decimal point. It must be greater than or equal to zero.
  89. * @exception SQLException if a database access error occurs
  90. * @see Types
  91. */
  92. void registerOutParameter(int parameterIndex, int sqlType, int scale)
  93. throws SQLException;
  94. /**
  95. * Retrieves whether the last OUT parameter read had the value of
  96. * SQL <code>NULL</code>. Note that this method should be called only after
  97. * calling a getter method; otherwise, there is no value to use in
  98. * determining whether it is <code>null</code> or not.
  99. *
  100. * @return <code>true</code> if the last parameter read was SQL
  101. * <code>NULL</code> <code>false</code> otherwise
  102. * @exception SQLException if a database access error occurs
  103. */
  104. boolean wasNull() throws SQLException;
  105. /**
  106. * Retrieves the value of the designated JDBC <code>CHAR</code>,
  107. * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> parameter as a
  108. * <code>String</code> in the Java programming language.
  109. * <p>
  110. * For the fixed-length type JDBC <code>CHAR</code>,
  111. * the <code>String</code> object
  112. * returned has exactly the same value the JDBC
  113. * <code>CHAR</code> value had in the
  114. * database, including any padding added by the database.
  115. *
  116. * @param parameterIndex the first parameter is 1, the second is 2,
  117. * and so on
  118. * @return the parameter value. If the value is SQL <code>NULL</code>,
  119. * the result
  120. * is <code>null</code>.
  121. * @exception SQLException if a database access error occurs
  122. * @see #setString
  123. */
  124. String getString(int parameterIndex) throws SQLException;
  125. /**
  126. * Retrieves the value of the designated JDBC <code>BIT</code> parameter as a
  127. * <code>boolean</code> in the Java programming language.
  128. *
  129. * @param parameterIndex the first parameter is 1, the second is 2,
  130. * and so on
  131. * @return the parameter value. If the value is SQL <code>NULL</code>,
  132. * the result is <code>false</code>.
  133. * @exception SQLException if a database access error occurs
  134. * @see #setBoolean
  135. */
  136. boolean getBoolean(int parameterIndex) throws SQLException;
  137. /**
  138. * Retrieves the value of the designated JDBC <code>TINYINT</code> parameter
  139. * as a <code>byte</code> in the Java programming language.
  140. *
  141. * @param parameterIndex the first parameter is 1, the second is 2,
  142. * and so on
  143. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  144. * is <code>0</code>.
  145. * @exception SQLException if a database access error occurs
  146. * @see #setByte
  147. */
  148. byte getByte(int parameterIndex) throws SQLException;
  149. /**
  150. * Retrieves the value of the designated JDBC <code>SMALLINT</code> parameter
  151. * as a <code>short</code> in the Java programming language.
  152. *
  153. * @param parameterIndex the first parameter is 1, the second is 2,
  154. * and so on
  155. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  156. * is <code>0</code>.
  157. * @exception SQLException if a database access error occurs
  158. * @see #setShort
  159. */
  160. short getShort(int parameterIndex) throws SQLException;
  161. /**
  162. * Retrieves the value of the designated JDBC <code>INTEGER</code> parameter
  163. * as an <code>int</code> in the Java programming language.
  164. *
  165. * @param parameterIndex the first parameter is 1, the second is 2,
  166. * and so on
  167. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  168. * is <code>0</code>.
  169. * @exception SQLException if a database access error occurs
  170. * @see #setInt
  171. */
  172. int getInt(int parameterIndex) throws SQLException;
  173. /**
  174. * Retrieves the value of the designated JDBC <code>BIGINT</code> parameter
  175. * as a <code>long</code> in the Java programming language.
  176. *
  177. * @param parameterIndex the first parameter is 1, the second is 2,
  178. * and so on
  179. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  180. * is <code>0</code>.
  181. * @exception SQLException if a database access error occurs
  182. * @see #setLong
  183. */
  184. long getLong(int parameterIndex) throws SQLException;
  185. /**
  186. * Retrieves the value of the designated JDBC <code>FLOAT</code> parameter
  187. * as a <code>float</code> in the Java programming language.
  188. *
  189. * @param parameterIndex the first parameter is 1, the second is 2,
  190. * and so on
  191. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  192. * is <code>0</code>.
  193. * @exception SQLException if a database access error occurs
  194. * @see #setFloat
  195. */
  196. float getFloat(int parameterIndex) throws SQLException;
  197. /**
  198. * Retrieves the value of the designated JDBC <code>DOUBLE</code> parameter as a <code>double</code>
  199. * in the Java programming language.
  200. * @param parameterIndex the first parameter is 1, the second is 2,
  201. * and so on
  202. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  203. * is <code>0</code>.
  204. * @exception SQLException if a database access error occurs
  205. * @see #setDouble
  206. */
  207. double getDouble(int parameterIndex) throws SQLException;
  208. /**
  209. * Retrieves the value of the designated JDBC <code>NUMERIC</code> parameter as a
  210. * <code>java.math.BigDecimal</code> object with <i>scale</i> digits to
  211. * the right of the decimal point.
  212. * @param parameterIndex the first parameter is 1, the second is 2,
  213. * and so on
  214. * @param scale the number of digits to the right of the decimal point
  215. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  216. * is <code>null</code>.
  217. * @exception SQLException if a database access error occurs
  218. * @deprecated use <code>getBigDecimal(int parameterIndex)</code>
  219. * or <code>getBigDecimal(String parameterName)</code>
  220. * @see #setBigDecimal
  221. */
  222. @Deprecated
  223. BigDecimal getBigDecimal(int parameterIndex, int scale)
  224. throws SQLException;
  225. /**
  226. * Retrieves the value of the designated JDBC <code>BINARY</code> or
  227. * <code>VARBINARY</code> parameter as an array of <code>byte</code>
  228. * values in the Java programming language.
  229. * @param parameterIndex the first parameter is 1, the second is 2,
  230. * and so on
  231. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  232. * is <code>null</code>.
  233. * @exception SQLException if a database access error occurs
  234. * @see #setBytes
  235. */
  236. byte[] getBytes(int parameterIndex) throws SQLException;
  237. /**
  238. * Retrieves the value of the designated JDBC <code>DATE</code> parameter as a
  239. * <code>java.sql.Date</code> object.
  240. * @param parameterIndex the first parameter is 1, the second is 2,
  241. * and so on
  242. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  243. * is <code>null</code>.
  244. * @exception SQLException if a database access error occurs
  245. * @see #setDate
  246. */
  247. java.sql.Date getDate(int parameterIndex) throws SQLException;
  248. /**
  249. * Retrieves the value of the designated JDBC <code>TIME</code> parameter as a
  250. * <code>java.sql.Time</code> object.
  251. *
  252. * @param parameterIndex the first parameter is 1, the second is 2,
  253. * and so on
  254. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  255. * is <code>null</code>.
  256. * @exception SQLException if a database access error occurs
  257. * @see #setTime
  258. */
  259. java.sql.Time getTime(int parameterIndex) throws SQLException;
  260. /**
  261. * Retrieves the value of the designated JDBC <code>TIMESTAMP</code> parameter as a
  262. * <code>java.sql.Timestamp</code> object.
  263. *
  264. * @param parameterIndex the first parameter is 1, the second is 2,
  265. * and so on
  266. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  267. * is <code>null</code>.
  268. * @exception SQLException if a database access error occurs
  269. * @see #setTimestamp
  270. */
  271. java.sql.Timestamp getTimestamp(int parameterIndex)
  272. throws SQLException;
  273. //----------------------------------------------------------------------
  274. // Advanced features:
  275. /**
  276. * Retrieves the value of the designated parameter as an <code>Object</code>
  277. * in the Java programming language. If the value is an SQL <code>NULL</code>,
  278. * the driver returns a Java <code>null</code>.
  279. * <p>
  280. * This method returns a Java object whose type corresponds to the JDBC
  281. * type that was registered for this parameter using the method
  282. * <code>registerOutParameter</code>. By registering the target JDBC
  283. * type as <code>java.sql.Types.OTHER</code>, this method can be used
  284. * to read database-specific abstract data types.
  285. *
  286. * @param parameterIndex the first parameter is 1, the second is 2,
  287. * and so on
  288. * @return A <code>java.lang.Object</code> holding the OUT parameter value
  289. * @exception SQLException if a database access error occurs
  290. * @see Types
  291. * @see #setObject
  292. */
  293. Object getObject(int parameterIndex) throws SQLException;
  294. //--------------------------JDBC 2.0-----------------------------
  295. /**
  296. * Retrieves the value of the designated JDBC <code>NUMERIC</code> parameter as a
  297. * <code>java.math.BigDecimal</code> object with as many digits to the
  298. * right of the decimal point as the value contains.
  299. * @param parameterIndex the first parameter is 1, the second is 2,
  300. * and so on
  301. * @return the parameter value in full precision. If the value is
  302. * SQL <code>NULL</code>, the result is <code>null</code>.
  303. * @exception SQLException if a database access error occurs
  304. * @see #setBigDecimal
  305. * @since 1.2
  306. */
  307. BigDecimal getBigDecimal(int parameterIndex) throws SQLException;
  308. /**
  309. * Returns an object representing the value of OUT parameter
  310. * <code>i</code> and uses <code>map</code> for the custom
  311. * mapping of the parameter value.
  312. * <p>
  313. * This method returns a Java object whose type corresponds to the
  314. * JDBC type that was registered for this parameter using the method
  315. * <code>registerOutParameter</code>. By registering the target
  316. * JDBC type as <code>java.sql.Types.OTHER</code>, this method can
  317. * be used to read database-specific abstract data types.
  318. * @param i the first parameter is 1, the second is 2, and so on
  319. * @param map the mapping from SQL type names to Java classes
  320. * @return a <code>java.lang.Object</code> holding the OUT parameter value
  321. * @exception SQLException if a database access error occurs
  322. * @see #setObject
  323. * @since 1.2
  324. */
  325. Object getObject(int i, java.util.Map<String,Class<?>> map)
  326. throws SQLException;
  327. /**
  328. * Retrieves the value of the designated JDBC <code>REF(<structured-type>)</code>
  329. * parameter as a {@link Ref} object in the Java programming language.
  330. * @param i the first parameter is 1, the second is 2,
  331. * and so on
  332. * @return the parameter value as a <code>Ref</code> object in the
  333. * Java programming language. If the value was SQL <code>NULL</code>, the value
  334. * <code>null</code> is returned.
  335. * @exception SQLException if a database access error occurs
  336. * @since 1.2
  337. */
  338. Ref getRef (int i) throws SQLException;
  339. /**
  340. * Retrieves the value of the designated JDBC <code>BLOB</code> parameter as a
  341. * {@link Blob} object in the Java programming language.
  342. * @param i the first parameter is 1, the second is 2, and so on
  343. * @return the parameter value as a <code>Blob</code> object in the
  344. * Java programming language. If the value was SQL <code>NULL</code>, the value
  345. * <code>null</code> is returned.
  346. * @exception SQLException if a database access error occurs
  347. * @since 1.2
  348. */
  349. Blob getBlob (int i) throws SQLException;
  350. /**
  351. * Retrieves the value of the designated JDBC <code>CLOB</code> parameter as a
  352. * <code>Clob</code> object in the Java programming language.
  353. * @param i the first parameter is 1, the second is 2, and
  354. * so on
  355. * @return the parameter value as a <code>Clob</code> object in the
  356. * Java programming language. If the value was SQL <code>NULL</code>, the
  357. * value <code>null</code> is returned.
  358. * @exception SQLException if a database access error occurs
  359. * @since 1.2
  360. */
  361. Clob getClob (int i) throws SQLException;
  362. /**
  363. *
  364. * Retrieves the value of the designated JDBC <code>ARRAY</code> parameter as an
  365. * {@link Array} object in the Java programming language.
  366. * @param i the first parameter is 1, the second is 2, and
  367. * so on
  368. * @return the parameter value as an <code>Array</code> object in
  369. * the Java programming language. If the value was SQL <code>NULL</code>, the
  370. * value <code>null</code> is returned.
  371. * @exception SQLException if a database access error occurs
  372. * @since 1.2
  373. */
  374. Array getArray (int i) throws SQLException;
  375. /**
  376. * Retrieves the value of the designated JDBC <code>DATE</code> parameter as a
  377. * <code>java.sql.Date</code> object, using
  378. * the given <code>Calendar</code> object
  379. * to construct the date.
  380. * With a <code>Calendar</code> object, the driver
  381. * can calculate the date taking into account a custom timezone and locale.
  382. * If no <code>Calendar</code> object is specified, the driver uses the
  383. * default timezone and locale.
  384. *
  385. * @param parameterIndex the first parameter is 1, the second is 2,
  386. * and so on
  387. * @param cal the <code>Calendar</code> object the driver will use
  388. * to construct the date
  389. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  390. * is <code>null</code>.
  391. * @exception SQLException if a database access error occurs
  392. * @see #setDate
  393. * @since 1.2
  394. */
  395. java.sql.Date getDate(int parameterIndex, Calendar cal)
  396. throws SQLException;
  397. /**
  398. * Retrieves the value of the designated JDBC <code>TIME</code> parameter as a
  399. * <code>java.sql.Time</code> object, using
  400. * the given <code>Calendar</code> object
  401. * to construct the time.
  402. * With a <code>Calendar</code> object, the driver
  403. * can calculate the time taking into account a custom timezone and locale.
  404. * If no <code>Calendar</code> object is specified, the driver uses the
  405. * default timezone and locale.
  406. *
  407. * @param parameterIndex the first parameter is 1, the second is 2,
  408. * and so on
  409. * @param cal the <code>Calendar</code> object the driver will use
  410. * to construct the time
  411. * @return the parameter value; if the value is SQL <code>NULL</code>, the result
  412. * is <code>null</code>.
  413. * @exception SQLException if a database access error occurs
  414. * @see #setTime
  415. * @since 1.2
  416. */
  417. java.sql.Time getTime(int parameterIndex, Calendar cal)
  418. throws SQLException;
  419. /**
  420. * Retrieves the value of the designated JDBC <code>TIMESTAMP</code> parameter as a
  421. * <code>java.sql.Timestamp</code> object, using
  422. * the given <code>Calendar</code> object to construct
  423. * the <code>Timestamp</code> object.
  424. * With a <code>Calendar</code> object, the driver
  425. * can calculate the timestamp taking into account a custom timezone and locale.
  426. * If no <code>Calendar</code> object is specified, the driver uses the
  427. * default timezone and locale.
  428. *
  429. *
  430. * @param parameterIndex the first parameter is 1, the second is 2,
  431. * and so on
  432. * @param cal the <code>Calendar</code> object the driver will use
  433. * to construct the timestamp
  434. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  435. * is <code>null</code>.
  436. * @exception SQLException if a database access error occurs
  437. * @see #setTimestamp
  438. * @since 1.2
  439. */
  440. java.sql.Timestamp getTimestamp(int parameterIndex, Calendar cal)
  441. throws SQLException;
  442. /**
  443. * Registers the designated output parameter. This version of
  444. * the method <code>registerOutParameter</code>
  445. * should be used for a user-defined or <code>REF</code> output parameter. Examples
  446. * of user-defined types include: <code>STRUCT</code>, <code>DISTINCT</code>,
  447. * <code>JAVA_OBJECT</code>, and named array types.
  448. *
  449. * Before executing a stored procedure call, you must explicitly
  450. * call <code>registerOutParameter</code> to register the type from
  451. * <code>java.sql.Types</code> for each
  452. * OUT parameter. For a user-defined parameter, the fully-qualified SQL
  453. * type name of the parameter should also be given, while a <code>REF</code>
  454. * parameter requires that the fully-qualified type name of the
  455. * referenced type be given. A JDBC driver that does not need the
  456. * type code and type name information may ignore it. To be portable,
  457. * however, applications should always provide these values for
  458. * user-defined and <code>REF</code> parameters.
  459. *
  460. * Although it is intended for user-defined and <code>REF</code> parameters,
  461. * this method may be used to register a parameter of any JDBC type.
  462. * If the parameter does not have a user-defined or <code>REF</code> type, the
  463. * <i>typeName</i> parameter is ignored.
  464. *
  465. * <P><B>Note:</B> When reading the value of an out parameter, you
  466. * must use the getter method whose Java type corresponds to the
  467. * parameter's registered SQL type.
  468. *
  469. * @param paramIndex the first parameter is 1, the second is 2,...
  470. * @param sqlType a value from {@link java.sql.Types}
  471. * @param typeName the fully-qualified name of an SQL structured type
  472. * @exception SQLException if a database access error occurs
  473. * @see Types
  474. * @since 1.2
  475. */
  476. void registerOutParameter (int paramIndex, int sqlType, String typeName)
  477. throws SQLException;
  478. //--------------------------JDBC 3.0-----------------------------
  479. /**
  480. * Registers the OUT parameter named
  481. * <code>parameterName</code> to the JDBC type
  482. * <code>sqlType</code>. All OUT parameters must be registered
  483. * before a stored procedure is executed.
  484. * <p>
  485. * The JDBC type specified by <code>sqlType</code> for an OUT
  486. * parameter determines the Java type that must be used
  487. * in the <code>get</code> method to read the value of that parameter.
  488. * <p>
  489. * If the JDBC type expected to be returned to this output parameter
  490. * is specific to this particular database, <code>sqlType</code>
  491. * should be <code>java.sql.Types.OTHER</code>. The method
  492. * {@link #getObject} retrieves the value.
  493. * @param parameterName the name of the parameter
  494. * @param sqlType the JDBC type code defined by <code>java.sql.Types</code>.
  495. * If the parameter is of JDBC type <code>NUMERIC</code>
  496. * or <code>DECIMAL</code>, the version of
  497. * <code>registerOutParameter</code> that accepts a scale value
  498. * should be used.
  499. * @exception SQLException if a database access error occurs
  500. * @since 1.4
  501. * @see Types
  502. */
  503. void registerOutParameter(String parameterName, int sqlType)
  504. throws SQLException;
  505. /**
  506. * Registers the parameter named
  507. * <code>parameterName</code> to be of JDBC type
  508. * <code>sqlType</code>. This method must be called
  509. * before a stored procedure is executed.
  510. * <p>
  511. * The JDBC type specified by <code>sqlType</code> for an OUT
  512. * parameter determines the Java type that must be used
  513. * in the <code>get</code> method to read the value of that parameter.
  514. * <p>
  515. * This version of <code>registerOutParameter</code> should be
  516. * used when the parameter is of JDBC type <code>NUMERIC</code>
  517. * or <code>DECIMAL</code>.
  518. * @param parameterName the name of the parameter
  519. * @param sqlType SQL type code defined by <code>java.sql.Types</code>.
  520. * @param scale the desired number of digits to the right of the
  521. * decimal point. It must be greater than or equal to zero.
  522. * @exception SQLException if a database access error occurs
  523. * @since 1.4
  524. * @see Types
  525. */
  526. void registerOutParameter(String parameterName, int sqlType, int scale)
  527. throws SQLException;
  528. /**
  529. * Registers the designated output parameter. This version of
  530. * the method <code>registerOutParameter</code>
  531. * should be used for a user-named or REF output parameter. Examples
  532. * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
  533. * named array types.
  534. *
  535. * Before executing a stored procedure call, you must explicitly
  536. * call <code>registerOutParameter</code> to register the type from
  537. * <code>java.sql.Types</code> for each
  538. * OUT parameter. For a user-named parameter the fully-qualified SQL
  539. * type name of the parameter should also be given, while a REF
  540. * parameter requires that the fully-qualified type name of the
  541. * referenced type be given. A JDBC driver that does not need the
  542. * type code and type name information may ignore it. To be portable,
  543. * however, applications should always provide these values for
  544. * user-named and REF parameters.
  545. *
  546. * Although it is intended for user-named and REF parameters,
  547. * this method may be used to register a parameter of any JDBC type.
  548. * If the parameter does not have a user-named or REF type, the
  549. * typeName parameter is ignored.
  550. *
  551. * <P><B>Note:</B> When reading the value of an out parameter, you
  552. * must use the <code>getXXX</code> method whose Java type XXX corresponds to the
  553. * parameter's registered SQL type.
  554. *
  555. * @param parameterName the name of the parameter
  556. * @param sqlType a value from {@link java.sql.Types}
  557. * @param typeName the fully-qualified name of an SQL structured type
  558. * @exception SQLException if a database access error occurs
  559. * @see Types
  560. * @since 1.4
  561. */
  562. void registerOutParameter (String parameterName, int sqlType, String typeName)
  563. throws SQLException;
  564. /**
  565. * Retrieves the value of the designated JDBC <code>DATALINK</code> parameter as a
  566. * <code>java.net.URL</code> object.
  567. *
  568. * @param parameterIndex the first parameter is 1, the second is 2,...
  569. * @return a <code>java.net.URL</code> object that represents the
  570. * JDBC <code>DATALINK</code> value used as the designated
  571. * parameter
  572. * @exception SQLException if a database access error occurs,
  573. * or if the URL being returned is
  574. * not a valid URL on the Java platform
  575. * @see #setURL
  576. * @since 1.4
  577. */
  578. java.net.URL getURL(int parameterIndex) throws SQLException;
  579. /**
  580. * Sets the designated parameter to the given <code>java.net.URL</code> object.
  581. * The driver converts this to an SQL <code>DATALINK</code> value when
  582. * it sends it to the database.
  583. *
  584. * @param parameterName the name of the parameter
  585. * @param val the parameter value
  586. * @exception SQLException if a database access error occurs,
  587. * or if a URL is malformed
  588. * @see #getURL
  589. * @since 1.4
  590. */
  591. void setURL(String parameterName, java.net.URL val) throws SQLException;
  592. /**
  593. * Sets the designated parameter to SQL <code>NULL</code>.
  594. *
  595. * <P><B>Note:</B> You must specify the parameter's SQL type.
  596. *
  597. * @param parameterName the name of the parameter
  598. * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
  599. * @exception SQLException if a database access error occurs
  600. * @since 1.4
  601. */
  602. void setNull(String parameterName, int sqlType) throws SQLException;
  603. /**
  604. * Sets the designated parameter to the given Java <code>boolean</code> value.
  605. * The driver converts this
  606. * to an SQL <code>BIT</code> value when it sends it to the database.
  607. *
  608. * @param parameterName the name of the parameter
  609. * @param x the parameter value
  610. * @exception SQLException if a database access error occurs
  611. * @see #getBoolean
  612. * @since 1.4
  613. */
  614. void setBoolean(String parameterName, boolean x) throws SQLException;
  615. /**
  616. * Sets the designated parameter to the given Java <code>byte</code> value.
  617. * The driver converts this
  618. * to an SQL <code>TINYINT</code> value when it sends it to the database.
  619. *
  620. * @param parameterName the name of the parameter
  621. * @param x the parameter value
  622. * @exception SQLException if a database access error occurs
  623. * @see #getByte
  624. * @since 1.4
  625. */
  626. void setByte(String parameterName, byte x) throws SQLException;
  627. /**
  628. * Sets the designated parameter to the given Java <code>short</code> value.
  629. * The driver converts this
  630. * to an SQL <code>SMALLINT</code> value when it sends it to the database.
  631. *
  632. * @param parameterName the name of the parameter
  633. * @param x the parameter value
  634. * @exception SQLException if a database access error occurs
  635. * @see #getShort
  636. * @since 1.4
  637. */
  638. void setShort(String parameterName, short x) throws SQLException;
  639. /**
  640. * Sets the designated parameter to the given Java <code>int</code> value.
  641. * The driver converts this
  642. * to an SQL <code>INTEGER</code> value when it sends it to the database.
  643. *
  644. * @param parameterName the name of the parameter
  645. * @param x the parameter value
  646. * @exception SQLException if a database access error occurs
  647. * @see #getInt
  648. * @since 1.4
  649. */
  650. void setInt(String parameterName, int x) throws SQLException;
  651. /**
  652. * Sets the designated parameter to the given Java <code>long</code> value.
  653. * The driver converts this
  654. * to an SQL <code>BIGINT</code> value when it sends it to the database.
  655. *
  656. * @param parameterName the name of the parameter
  657. * @param x the parameter value
  658. * @exception SQLException if a database access error occurs
  659. * @see #getLong
  660. * @since 1.4
  661. */
  662. void setLong(String parameterName, long x) throws SQLException;
  663. /**
  664. * Sets the designated parameter to the given Java <code>float</code> value.
  665. * The driver converts this
  666. * to an SQL <code>FLOAT</code> value when it sends it to the database.
  667. *
  668. * @param parameterName the name of the parameter
  669. * @param x the parameter value
  670. * @exception SQLException if a database access error occurs
  671. * @see #getFloat
  672. * @since 1.4
  673. */
  674. void setFloat(String parameterName, float x) throws SQLException;
  675. /**
  676. * Sets the designated parameter to the given Java <code>double</code> value.
  677. * The driver converts this
  678. * to an SQL <code>DOUBLE</code> value when it sends it to the database.
  679. *
  680. * @param parameterName the name of the parameter
  681. * @param x the parameter value
  682. * @exception SQLException if a database access error occurs
  683. * @see #getDouble
  684. * @since 1.4
  685. */
  686. void setDouble(String parameterName, double x) throws SQLException;
  687. /**
  688. * Sets the designated parameter to the given
  689. * <code>java.math.BigDecimal</code> value.
  690. * The driver converts this to an SQL <code>NUMERIC</code> value when
  691. * it sends it to the database.
  692. *
  693. * @param parameterName the name of the parameter
  694. * @param x the parameter value
  695. * @exception SQLException if a database access error occurs
  696. * @see #getBigDecimal
  697. * @since 1.4
  698. */
  699. void setBigDecimal(String parameterName, BigDecimal x) throws SQLException;
  700. /**
  701. * Sets the designated parameter to the given Java <code>String</code> value.
  702. * The driver converts this
  703. * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
  704. * (depending on the argument's
  705. * size relative to the driver's limits on <code>VARCHAR</code> values)
  706. * when it sends it to the database.
  707. *
  708. * @param parameterName the name of the parameter
  709. * @param x the parameter value
  710. * @exception SQLException if a database access error occurs
  711. * @see #getString
  712. * @since 1.4
  713. */
  714. void setString(String parameterName, String x) throws SQLException;
  715. /**
  716. * Sets the designated parameter to the given Java array of bytes.
  717. * The driver converts this to an SQL <code>VARBINARY</code> or
  718. * <code>LONGVARBINARY</code> (depending on the argument's size relative
  719. * to the driver's limits on <code>VARBINARY</code> values) when it sends
  720. * it to the database.
  721. *
  722. * @param parameterName the name of the parameter
  723. * @param x the parameter value
  724. * @exception SQLException if a database access error occurs
  725. * @see #getBytes
  726. * @since 1.4
  727. */
  728. void setBytes(String parameterName, byte x[]) throws SQLException;
  729. /**
  730. * Sets the designated parameter to the given <code>java.sql.Date</code> value.
  731. * The driver converts this
  732. * to an SQL <code>DATE</code> value when it sends it to the database.
  733. *
  734. * @param parameterName the name of the parameter
  735. * @param x the parameter value
  736. * @exception SQLException if a database access error occurs
  737. * @see #getDate
  738. * @since 1.4
  739. */
  740. void setDate(String parameterName, java.sql.Date x)
  741. throws SQLException;
  742. /**
  743. * Sets the designated parameter to the given <code>java.sql.Time</code> value.
  744. * The driver converts this
  745. * to an SQL <code>TIME</code> value when it sends it to the database.
  746. *
  747. * @param parameterName the name of the parameter
  748. * @param x the parameter value
  749. * @exception SQLException if a database access error occurs
  750. * @see #getTime
  751. * @since 1.4
  752. */
  753. void setTime(String parameterName, java.sql.Time x)
  754. throws SQLException;
  755. /**
  756. * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.
  757. * The driver
  758. * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
  759. * database.
  760. *
  761. * @param parameterName the name of the parameter
  762. * @param x the parameter value
  763. * @exception SQLException if a database access error occurs
  764. * @see #getTimestamp
  765. * @since 1.4
  766. */
  767. void setTimestamp(String parameterName, java.sql.Timestamp x)
  768. throws SQLException;
  769. /**
  770. * Sets the designated parameter to the given input stream, which will have
  771. * the specified number of bytes.
  772. * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
  773. * parameter, it may be more practical to send it via a
  774. * <code>java.io.InputStream</code>. Data will be read from the stream
  775. * as needed until end-of-file is reached. The JDBC driver will
  776. * do any necessary conversion from ASCII to the database char format.
  777. *
  778. * <P><B>Note:</B> This stream object can either be a standard
  779. * Java stream object or your own subclass that implements the
  780. * standard interface.
  781. *
  782. * @param parameterName the name of the parameter
  783. * @param x the Java input stream that contains the ASCII parameter value
  784. * @param length the number of bytes in the stream
  785. * @exception SQLException if a database access error occurs
  786. * @since 1.4
  787. */
  788. void setAsciiStream(String parameterName, java.io.InputStream x, int length)
  789. throws SQLException;
  790. /**
  791. * Sets the designated parameter to the given input stream, which will have
  792. * the specified number of bytes.
  793. * When a very large binary value is input to a <code>LONGVARBINARY</code>
  794. * parameter, it may be more practical to send it via a
  795. * <code>java.io.InputStream</code> object. The data will be read from the stream
  796. * as needed until end-of-file is reached.
  797. *
  798. * <P><B>Note:</B> This stream object can either be a standard
  799. * Java stream object or your own subclass that implements the
  800. * standard interface.
  801. *
  802. * @param parameterName the name of the parameter
  803. * @param x the java input stream which contains the binary parameter value
  804. * @param length the number of bytes in the stream
  805. * @exception SQLException if a database access error occurs
  806. * @since 1.4
  807. */
  808. void setBinaryStream(String parameterName, java.io.InputStream x,
  809. int length) throws SQLException;
  810. /**
  811. * Sets the value of the designated parameter with the given object. The second
  812. * argument must be an object type; for integral values, the
  813. * <code>java.lang</code> equivalent objects should be used.
  814. *
  815. * <p>The given Java object will be converted to the given targetSqlType
  816. * before being sent to the database.
  817. *
  818. * If the object has a custom mapping (is of a class implementing the
  819. * interface <code>SQLData</code>),
  820. * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it
  821. * to the SQL data stream.
  822. * If, on the other hand, the object is of a class implementing
  823. * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
  824. * or <code>Array</code>, the driver should pass it to the database as a
  825. * value of the corresponding SQL type.
  826. * <P>
  827. * Note that this method may be used to pass datatabase-
  828. * specific abstract data types.
  829. *
  830. * @param parameterName the name of the parameter
  831. * @param x the object containing the input parameter value
  832. * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
  833. * sent to the database. The scale argument may further qualify this type.
  834. * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
  835. * this is the number of digits after the decimal point. For all other
  836. * types, this value will be ignored.
  837. * @exception SQLException if a database access error occurs
  838. * @see Types
  839. * @see #getObject
  840. * @since 1.4
  841. */
  842. void setObject(String parameterName, Object x, int targetSqlType, int scale)
  843. throws SQLException;
  844. /**
  845. * Sets the value of the designated parameter with the given object.
  846. * This method is like the method <code>setObject</code>
  847. * above, except that it assumes a scale of zero.
  848. *
  849. * @param parameterName the name of the parameter
  850. * @param x the object containing the input parameter value
  851. * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
  852. * sent to the database
  853. * @exception SQLException if a database access error occurs
  854. * @see #getObject
  855. * @since 1.4
  856. */
  857. void setObject(String parameterName, Object x, int targetSqlType)
  858. throws SQLException;
  859. /**
  860. * Sets the value of the designated parameter with the given object.
  861. * The second parameter must be of type <code>Object</code> therefore, the
  862. * <code>java.lang</code> equivalent objects should be used for built-in types.
  863. *
  864. * <p>The JDBC specification specifies a standard mapping from
  865. * Java <code>Object</code> types to SQL types. The given argument
  866. * will be converted to the corresponding SQL type before being
  867. * sent to the database.
  868. *
  869. * <p>Note that this method may be used to pass datatabase-
  870. * specific abstract data types, by using a driver-specific Java
  871. * type.
  872. *
  873. * If the object is of a class implementing the interface <code>SQLData</code>,
  874. * the JDBC driver should call the method <code>SQLData.writeSQL</code>
  875. * to write it to the SQL data stream.
  876. * If, on the other hand, the object is of a class implementing
  877. * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
  878. * or <code>Array</code>, the driver should pass it to the database as a
  879. * value of the corresponding SQL type.
  880. * <P>
  881. * This method throws an exception if there is an ambiguity, for example, if the
  882. * object is of a class implementing more than one of the interfaces named above.
  883. *
  884. * @param parameterName the name of the parameter
  885. * @param x the object containing the input parameter value
  886. * @exception SQLException if a database access error occurs or if the given
  887. * <code>Object</code> parameter is ambiguous
  888. * @see #getObject
  889. * @since 1.4
  890. */
  891. void setObject(String parameterName, Object x) throws SQLException;
  892. /**
  893. * Sets the designated parameter to the given <code>Reader</code>
  894. * object, which is the given number of characters long.
  895. * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
  896. * parameter, it may be more practical to send it via a
  897. * <code>java.io.Reader</code> object. The data will be read from the stream
  898. * as needed until end-of-file is reached. The JDBC driver will
  899. * do any necessary conversion from UNICODE to the database char format.
  900. *
  901. * <P><B>Note:</B> This stream object can either be a standard
  902. * Java stream object or your own subclass that implements the
  903. * standard interface.
  904. *
  905. * @param parameterName the name of the parameter
  906. * @param reader the <code>java.io.Reader</code> object that
  907. * contains the UNICODE data used as the designated parameter
  908. * @param length the number of characters in the stream
  909. * @exception SQLException if a database access error occurs
  910. * @since 1.4
  911. */
  912. void setCharacterStream(String parameterName,
  913. java.io.Reader reader,
  914. int length) throws SQLException;
  915. /**
  916. * Sets the designated parameter to the given <code>java.sql.Date</code> value,
  917. * using the given <code>Calendar</code> object. The driver uses
  918. * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
  919. * which the driver then sends to the database. With a
  920. * a <code>Calendar</code> object, the driver can calculate the date
  921. * taking into account a custom timezone. If no
  922. * <code>Calendar</code> object is specified, the driver uses the default
  923. * timezone, which is that of the virtual machine running the application.
  924. *
  925. * @param parameterName the name of the parameter
  926. * @param x the parameter value
  927. * @param cal the <code>Calendar</code> object the driver will use
  928. * to construct the date
  929. * @exception SQLException if a database access error occurs
  930. * @see #getDate
  931. * @since 1.4
  932. */
  933. void setDate(String parameterName, java.sql.Date x, Calendar cal)
  934. throws SQLException;
  935. /**
  936. * Sets the designated parameter to the given <code>java.sql.Time</code> value,
  937. * using the given <code>Calendar</code> object. The driver uses
  938. * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
  939. * which the driver then sends to the database. With a
  940. * a <code>Calendar</code> object, the driver can calculate the time
  941. * taking into account a custom timezone. If no
  942. * <code>Calendar</code> object is specified, the driver uses the default
  943. * timezone, which is that of the virtual machine running the application.
  944. *
  945. * @param parameterName the name of the parameter
  946. * @param x the parameter value
  947. * @param cal the <code>Calendar</code> object the driver will use
  948. * to construct the time
  949. * @exception SQLException if a database access error occurs
  950. * @see #getTime
  951. * @since 1.4
  952. */
  953. void setTime(String parameterName, java.sql.Time x, Calendar cal)
  954. throws SQLException;
  955. /**
  956. * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
  957. * using the given <code>Calendar</code> object. The driver uses
  958. * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
  959. * which the driver then sends to the database. With a
  960. * a <code>Calendar</code> object, the driver can calculate the timestamp
  961. * taking into account a custom timezone. If no
  962. * <code>Calendar</code> object is specified, the driver uses the default
  963. * timezone, which is that of the virtual machine running the application.
  964. *
  965. * @param parameterName the name of the parameter
  966. * @param x the parameter value
  967. * @param cal the <code>Calendar</code> object the driver will use
  968. * to construct the timestamp
  969. * @exception SQLException if a database access error occurs
  970. * @see #getTimestamp
  971. * @since 1.4
  972. */
  973. void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal)
  974. throws SQLException;
  975. /**
  976. * Sets the designated parameter to SQL <code>NULL</code>.
  977. * This version of the method <code>setNull</code> should
  978. * be used for user-defined types and REF type parameters. Examples
  979. * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
  980. * named array types.
  981. *
  982. * <P><B>Note:</B> To be portable, applications must give the
  983. * SQL type code and the fully-qualified SQL type name when specifying
  984. * a NULL user-defined or REF parameter. In the case of a user-defined type
  985. * the name is the type name of the parameter itself. For a REF
  986. * parameter, the name is the type name of the referenced type. If
  987. * a JDBC driver does not need the type code or type name information,
  988. * it may ignore it.
  989. *
  990. * Although it is intended for user-defined and Ref parameters,
  991. * this method may be used to set a null parameter of any JDBC type.
  992. * If the parameter does not have a user-defined or REF type, the given
  993. * typeName is ignored.
  994. *
  995. *
  996. * @param parameterName the name of the parameter
  997. * @param sqlType a value from <code>java.sql.Types</code>
  998. * @param typeName the fully-qualified name of an SQL user-defined type;
  999. * ignored if the parameter is not a user-defined type or
  1000. * SQL <code>REF</code> value
  1001. * @exception SQLException if a database access error occurs
  1002. * @since 1.4
  1003. */
  1004. void setNull (String parameterName, int sqlType, String typeName)
  1005. throws SQLException;
  1006. /**
  1007. * Retrieves the value of a JDBC <code>CHAR</code>, <code>VARCHAR</code>,
  1008. * or <code>LONGVARCHAR</code> parameter as a <code>String</code> in
  1009. * the Java programming language.
  1010. * <p>
  1011. * For the fixed-length type JDBC <code>CHAR</code>,
  1012. * the <code>String</code> object
  1013. * returned has exactly the same value the JDBC
  1014. * <code>CHAR</code> value had in the
  1015. * database, including any padding added by the database.
  1016. * @param parameterName the name of the parameter
  1017. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  1018. * is <code>null</code>.
  1019. * @exception SQLException if a database access error occurs
  1020. * @see #setString
  1021. * @since 1.4
  1022. */
  1023. String getString(String parameterName) throws SQLException;
  1024. /**
  1025. * Retrieves the value of a JDBC <code>BIT</code> parameter as a
  1026. * <code>boolean</code> in the Java programming language.
  1027. * @param parameterName the name of the parameter
  1028. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  1029. * is <code>false</code>.
  1030. * @exception SQLException if a database access error occurs
  1031. * @see #setBoolean
  1032. * @since 1.4
  1033. */
  1034. boolean getBoolean(String parameterName) throws SQLException;
  1035. /**
  1036. * Retrieves the value of a JDBC <code>TINYINT</code> parameter as a <code>byte</code>
  1037. * in the Java programming language.
  1038. * @param parameterName the name of the parameter
  1039. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  1040. * is <code>0</code>.
  1041. * @exception SQLException if a database access error occurs
  1042. * @see #setByte
  1043. * @since 1.4
  1044. */
  1045. byte getByte(String parameterName) throws SQLException;
  1046. /**
  1047. * Retrieves the value of a JDBC <code>SMALLINT</code> parameter as a <code>short</code>
  1048. * in the Java programming language.
  1049. * @param parameterName the name of the parameter
  1050. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  1051. * is <code>0</code>.
  1052. * @exception SQLException if a database access error occurs
  1053. * @see #setShort
  1054. * @since 1.4
  1055. */
  1056. short getShort(String parameterName) throws SQLException;
  1057. /**
  1058. * Retrieves the value of a JDBC <code>INTEGER</code> parameter as an <code>int</code>
  1059. * in the Java programming language.
  1060. *
  1061. * @param parameterName the name of the parameter
  1062. * @return the parameter value. If the value is SQL <code>NULL</code>,
  1063. * the result is <code>0</code>.
  1064. * @exception SQLException if a database access error occurs
  1065. * @see #setInt
  1066. * @since 1.4
  1067. */
  1068. int getInt(String parameterName) throws SQLException;
  1069. /**
  1070. * Retrieves the value of a JDBC <code>BIGINT</code> parameter as a <code>long</code>
  1071. * in the Java programming language.
  1072. *
  1073. * @param parameterName the name of the parameter
  1074. * @return the parameter value. If the value is SQL <code>NULL</code>,
  1075. * the result is <code>0</code>.
  1076. * @exception SQLException if a database access error occurs
  1077. * @see #setLong
  1078. * @since 1.4
  1079. */
  1080. long getLong(String parameterName) throws SQLException;
  1081. /**
  1082. * Retrieves the value of a JDBC <code>FLOAT</code> parameter as a <code>float</code>
  1083. * in the Java programming language.
  1084. * @param parameterName the name of the parameter
  1085. * @return the parameter value. If the value is SQL <code>NULL</code>,
  1086. * the result is <code>0</code>.
  1087. * @exception SQLException if a database access error occurs
  1088. * @see #setFloat
  1089. * @since 1.4
  1090. */
  1091. float getFloat(String parameterName) throws SQLException;
  1092. /**
  1093. * Retrieves the value of a JDBC <code>DOUBLE</code> parameter as a <code>double</code>
  1094. * in the Java programming language.
  1095. * @param parameterName the name of the parameter
  1096. * @return the parameter value. If the value is SQL <code>NULL</code>,
  1097. * the result is <code>0</code>.
  1098. * @exception SQLException if a database access error occurs
  1099. * @see #setDouble
  1100. * @since 1.4
  1101. */
  1102. double getDouble(String parameterName) throws SQLException;
  1103. /**
  1104. * Retrieves the value of a JDBC <code>BINARY</code> or <code>VARBINARY</code>
  1105. * parameter as an array of <code>byte</code> values in the Java
  1106. * programming language.
  1107. * @param parameterName the name of the parameter
  1108. * @return the parameter value. If the value is SQL <code>NULL</code>, the result is
  1109. * <code>null</code>.
  1110. * @exception SQLException if a database access error occurs
  1111. * @see #setBytes
  1112. * @since 1.4
  1113. */
  1114. byte[] getBytes(String parameterName) throws SQLException;
  1115. /**
  1116. * Retrieves the value of a JDBC <code>DATE</code> parameter as a
  1117. * <code>java.sql.Date</code> object.
  1118. * @param parameterName the name of the parameter
  1119. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  1120. * is <code>null</code>.
  1121. * @exception SQLException if a database access error occurs
  1122. * @see #setDate
  1123. * @since 1.4
  1124. */
  1125. java.sql.Date getDate(String parameterName) throws SQLException;
  1126. /**
  1127. * Retrieves the value of a JDBC <code>TIME</code> parameter as a
  1128. * <code>java.sql.Time</code> object.
  1129. * @param parameterName the name of the parameter
  1130. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  1131. * is <code>null</code>.
  1132. * @exception SQLException if a database access error occurs
  1133. * @see #setTime
  1134. * @since 1.4
  1135. */
  1136. java.sql.Time getTime(String parameterName) throws SQLException;
  1137. /**
  1138. * Retrieves the value of a JDBC <code>TIMESTAMP</code> parameter as a
  1139. * <code>java.sql.Timestamp</code> object.
  1140. * @param parameterName the name of the parameter
  1141. * @return the parameter value. If the value is SQL <code>NULL</code>, the result
  1142. * is <code>null</code>.
  1143. * @exception SQLException if a database access error occurs
  1144. * @see #setTimestamp
  1145. * @since 1.4
  1146. */
  1147. java.sql.Timestamp getTimestamp(String parameterName) throws SQLException;
  1148. /**
  1149. * Retrieves the value of a parameter as an <code>Object</code> in the Java
  1150. * programming language. If the value is an SQL <code>NULL</code>, the
  1151. * driver returns a Java <code>null</code>.
  1152. * <p>
  1153. * This method returns a Java object whose type corresponds to the JDBC
  1154. * type that was registered for this parameter using the method
  1155. * <code>registerOutParameter</code>. By registering the target JDBC
  1156. * type as <code>java.sql.Types.OTHER</code>, this method can be used
  1157. * to read database-specific abstract data types.
  1158. * @param parameterName the name of the parameter
  1159. * @return A <code>java.lang.Object</code> holding the OUT parameter value.
  1160. * @exception SQLException if a database access error occurs
  1161. * @see Types
  1162. * @see #setObject
  1163. * @since 1.4
  1164. */
  1165. Object getObject(String parameterName) throws SQLException;
  1166. /**
  1167. * Retrieves the value of a JDBC <code>NUMERIC</code> parameter as a
  1168. * <code>java.math.BigDecimal</code> object with as many digits to the
  1169. * right of the decimal point as the value contains.
  1170. * @param parameterName the name of the parameter
  1171. * @return the parameter value in full precision. If the value is
  1172. * SQL <code>NULL</code>, the result is <code>null</code>.
  1173. * @exception SQLException if a database access error occurs
  1174. * @see #setBigDecimal
  1175. * @since 1.4
  1176. */
  1177. BigDecimal getBigDecimal(String parameterName) throws SQLException;
  1178. /**
  1179. * Returns an object representing the value of OUT parameter
  1180. * <code>i</code> and uses <code>map</code> for the custom
  1181. * mapping of the parameter value.
  1182. * <p>
  1183. * This method returns a Java object whose type corresponds to the
  1184. * JDBC type that was registered for this parameter using the method
  1185. * <code>registerOutParameter</code>. By registering the target
  1186. * JDBC type as <code>java.sql.Types.OTHER</code>, this method can
  1187. * be used to read database-specific abstract data types.
  1188. * @param parameterName the name of the parameter
  1189. * @param map the mapping from SQL type names to Java classes
  1190. * @return a <code>java.lang.Object</code> holding the OUT parameter value
  1191. * @exception SQLException if a database access error occurs
  1192. * @see #setObject
  1193. * @since 1.4
  1194. */
  1195. Object getObject(String parameterName, java.util.Map<String,Class<?>> map)
  1196. throws SQLException;
  1197. /**
  1198. * Retrieves the value of a JDBC <code>REF(<structured-type>)</code>
  1199. * parameter as a {@link Ref} object in the Java programming language.
  1200. *
  1201. * @param parameterName the name of the parameter
  1202. * @return the parameter value as a <code>Ref</code> object in the
  1203. * Java programming language. If the value was SQL <code>NULL</code>,
  1204. * the value <code>null</code> is returned.
  1205. * @exception SQLException if a database access error occurs
  1206. * @since 1.4
  1207. */
  1208. Ref getRef (String parameterName) throws SQLException;
  1209. /**
  1210. * Retrieves the value of a JDBC <code>BLOB</code> parameter as a
  1211. * {@link Blob} object in the Java programming language.
  1212. *
  1213. * @param parameterName the name of the parameter
  1214. * @return the parameter value as a <code>Blob</code> object in the
  1215. * Java programming language. If the value was SQL <code>NULL</code>,
  1216. * the value <code>null</code> is returned.
  1217. * @exception SQLException if a database access error occurs
  1218. * @since 1.4
  1219. */
  1220. Blob getBlob (String parameterName) throws SQLException;
  1221. /**
  1222. * Retrieves the value of a JDBC <code>CLOB</code> parameter as a
  1223. * <code>Clob</code> object in the Java programming language.
  1224. * @param parameterName the name of the parameter
  1225. * @return the parameter value as a <code>Clob</code> object in the
  1226. * Java programming language. If the value was SQL <code>NULL</code>,
  1227. * the value <code>null</code> is returned.
  1228. * @exception SQLException if a database access error occurs
  1229. * @since 1.4
  1230. */
  1231. Clob getClob (String parameterName) throws SQLException;
  1232. /**
  1233. * Retrieves the value of a JDBC <code>ARRAY</code> parameter as an
  1234. * {@link Array} object in the Java programming language.
  1235. *
  1236. * @param parameterName the name of the parameter
  1237. * @return the parameter value as an <code>Array</code> object in
  1238. * Java programming language. If the value was SQL <code>NULL</code>,
  1239. * the value <code>null</code> is returned.
  1240. * @exception SQLException if a database access error occurs
  1241. * @since 1.4
  1242. */
  1243. Array getArray (String parameterName) throws SQLException;
  1244. /**
  1245. * Retrieves the value of a JDBC <code>DATE</code> parameter as a
  1246. * <code>java.sql.Date</code> object, using
  1247. * the given <code>Calendar</code> object
  1248. * to construct the date.
  1249. * With a <code>Calendar</code> object, the driver
  1250. * can calculate the date taking into account a custom timezone and locale.
  1251. * If no <code>Calendar</code> object is specified, the driver uses the
  1252. * default timezone and locale.
  1253. *
  1254. * @param parameterName the name of the parameter
  1255. * @param cal the <code>Calendar</code> object the driver will use
  1256. * to construct the date
  1257. * @return the parameter value. If the value is SQL <code>NULL</code>,
  1258. * the result is <code>null</code>.
  1259. * @exception SQLException if a database access error occurs
  1260. * @see #setDate
  1261. * @since 1.4
  1262. */
  1263. java.sql.Date getDate(String parameterName, Calendar cal)
  1264. throws SQLException;
  1265. /**
  1266. * Retrieves the value of a JDBC <code>TIME</code> parameter as a
  1267. * <code>java.sql.Time</code> object, using
  1268. * the given <code>Calendar</code> object
  1269. * to construct the time.
  1270. * With a <code>Calendar</code> object, the driver
  1271. * can calculate the time taking into account a custom timezone and locale.
  1272. * If no <code>Calendar</code> object is specified, the driver uses the
  1273. * default timezone and locale.
  1274. *
  1275. * @param parameterName the name of the parameter
  1276. * @param cal the <code>Calendar</code> object the driver will use
  1277. * to construct the time
  1278. * @return the parameter value; if the value is SQL <code>NULL</code>, the result is
  1279. * <code>null</code>.
  1280. * @exception SQLException if a database access error occurs
  1281. * @see #setTime
  1282. * @since 1.4
  1283. */
  1284. java.sql.Time getTime(String parameterName, Calendar cal)
  1285. throws SQLException;
  1286. /**
  1287. * Retrieves the value of a JDBC <code>TIMESTAMP</code> parameter as a
  1288. * <code>java.sql.Timestamp</code> object, using
  1289. * the given <code>Calendar</code> object to construct
  1290. * the <code>Timestamp</code> object.
  1291. * With a <code>Calendar</code> object, the driver
  1292. * can calculate the timestamp taking into account a custom timezone and locale.
  1293. * If no <code>Calendar</code> object is specified, the driver uses the
  1294. * default timezone and locale.
  1295. *
  1296. *
  1297. * @param parameterName the name of the parameter
  1298. * @param cal the <code>Calendar</code> object the driver will use
  1299. * to construct the timestamp
  1300. * @return the parameter value. If the value is SQL <code>NULL</code>, the result is
  1301. * <code>null</code>.
  1302. * @exception SQLException if a database access error occurs
  1303. * @see #setTimestamp
  1304. * @since 1.4
  1305. */
  1306. java.sql.Timestamp getTimestamp(String parameterName, Calendar cal)
  1307. throws SQLException;
  1308. /**
  1309. * Retrieves the value of a JDBC <code>DATALINK</code> parameter as a
  1310. * <code>java.net.URL</code> object.
  1311. *
  1312. * @param parameterName the name of the parameter
  1313. * @return the parameter value as a <code>java.net.URL</code> object in the
  1314. * Java programming language. If the value was SQL <code>NULL</code>, the
  1315. * value <code>null</code> is returned.
  1316. * @exception SQLException if a database access error occurs,
  1317. * or if there is a problem with the URL
  1318. * @see #setURL
  1319. * @since 1.4
  1320. */
  1321. java.net.URL getURL(String parameterName) throws SQLException;
  1322. }