1. /*
  2. * @(#)PreparedStatement.java 1.42 03/01/23
  3. *
  4. * Copyright 2003 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. * An object that represents a precompiled SQL statement.
  12. * <P>A SQL statement is precompiled and stored in a
  13. * <code>PreparedStatement</code> object. This object can then be used to
  14. * efficiently execute this statement multiple times.
  15. *
  16. * <P><B>Note:</B> The setter methods (<code>setShort</code>, <code>setString</code>,
  17. * and so on) for setting IN parameter values
  18. * must specify types that are compatible with the defined SQL type of
  19. * the input parameter. For instance, if the IN parameter has SQL type
  20. * <code>INTEGER</code>, then the method <code>setInt</code> should be used.
  21. *
  22. * <p>If arbitrary parameter type conversions are required, the method
  23. * <code>setObject</code> should be used with a target SQL type.
  24. * <P>
  25. * In the following example of setting a parameter, <code>con</code> represents
  26. * an active connection:
  27. * <PRE>
  28. * PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
  29. * SET SALARY = ? WHERE ID = ?");
  30. * pstmt.setBigDecimal(1, 153833.00)
  31. * pstmt.setInt(2, 110592)
  32. * </PRE>
  33. *
  34. * @see Connection#prepareStatement
  35. * @see ResultSet
  36. */
  37. public interface PreparedStatement extends Statement {
  38. /**
  39. * Executes the SQL query in this <code>PreparedStatement</code> object
  40. * and returns the <code>ResultSet</code> object generated by the query.
  41. *
  42. * @return a <code>ResultSet</code> object that contains the data produced by the
  43. * query; never <code>null</code>
  44. * @exception SQLException if a database access error occurs or the SQL
  45. * statement does not return a <code>ResultSet</code> object
  46. */
  47. ResultSet executeQuery() throws SQLException;
  48. /**
  49. * Executes the SQL statement in this <code>PreparedStatement</code> object,
  50. * which must be an SQL <code>INSERT</code>, <code>UPDATE</code> or
  51. * <code>DELETE</code> statement; or an SQL statement that returns nothing,
  52. * such as a DDL statement.
  53. *
  54. * @return either (1) the row count for <code>INSERT</code>, <code>UPDATE</code>,
  55. * or <code>DELETE</code> statements
  56. * or (2) 0 for SQL statements that return nothing
  57. * @exception SQLException if a database access error occurs or the SQL
  58. * statement returns a <code>ResultSet</code> object
  59. */
  60. int executeUpdate() throws SQLException;
  61. /**
  62. * Sets the designated parameter to SQL <code>NULL</code>.
  63. *
  64. * <P><B>Note:</B> You must specify the parameter's SQL type.
  65. *
  66. * @param parameterIndex the first parameter is 1, the second is 2, ...
  67. * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
  68. * @exception SQLException if a database access error occurs
  69. */
  70. void setNull(int parameterIndex, int sqlType) throws SQLException;
  71. /**
  72. * Sets the designated parameter to the given Java <code>boolean</code> value.
  73. * The driver converts this
  74. * to an SQL <code>BIT</code> value when it sends it to the database.
  75. *
  76. * @param parameterIndex the first parameter is 1, the second is 2, ...
  77. * @param x the parameter value
  78. * @exception SQLException if a database access error occurs
  79. */
  80. void setBoolean(int parameterIndex, boolean x) throws SQLException;
  81. /**
  82. * Sets the designated parameter to the given Java <code>byte</code> value.
  83. * The driver converts this
  84. * to an SQL <code>TINYINT</code> value when it sends it to the database.
  85. *
  86. * @param parameterIndex the first parameter is 1, the second is 2, ...
  87. * @param x the parameter value
  88. * @exception SQLException if a database access error occurs
  89. */
  90. void setByte(int parameterIndex, byte x) throws SQLException;
  91. /**
  92. * Sets the designated parameter to the given Java <code>short</code> value.
  93. * The driver converts this
  94. * to an SQL <code>SMALLINT</code> value when it sends it to the database.
  95. *
  96. * @param parameterIndex the first parameter is 1, the second is 2, ...
  97. * @param x the parameter value
  98. * @exception SQLException if a database access error occurs
  99. */
  100. void setShort(int parameterIndex, short x) throws SQLException;
  101. /**
  102. * Sets the designated parameter to the given Java <code>int</code> value.
  103. * The driver converts this
  104. * to an SQL <code>INTEGER</code> value when it sends it to the database.
  105. *
  106. * @param parameterIndex the first parameter is 1, the second is 2, ...
  107. * @param x the parameter value
  108. * @exception SQLException if a database access error occurs
  109. */
  110. void setInt(int parameterIndex, int x) throws SQLException;
  111. /**
  112. * Sets the designated parameter to the given Java <code>long</code> value.
  113. * The driver converts this
  114. * to an SQL <code>BIGINT</code> value when it sends it to the database.
  115. *
  116. * @param parameterIndex the first parameter is 1, the second is 2, ...
  117. * @param x the parameter value
  118. * @exception SQLException if a database access error occurs
  119. */
  120. void setLong(int parameterIndex, long x) throws SQLException;
  121. /**
  122. * Sets the designated parameter to the given Java <code>float</code> value.
  123. * The driver converts this
  124. * to an SQL <code>FLOAT</code> value when it sends it to the database.
  125. *
  126. * @param parameterIndex the first parameter is 1, the second is 2, ...
  127. * @param x the parameter value
  128. * @exception SQLException if a database access error occurs
  129. */
  130. void setFloat(int parameterIndex, float x) throws SQLException;
  131. /**
  132. * Sets the designated parameter to the given Java <code>double</code> value.
  133. * The driver converts this
  134. * to an SQL <code>DOUBLE</code> value when it sends it to the database.
  135. *
  136. * @param parameterIndex the first parameter is 1, the second is 2, ...
  137. * @param x the parameter value
  138. * @exception SQLException if a database access error occurs
  139. */
  140. void setDouble(int parameterIndex, double x) throws SQLException;
  141. /**
  142. * Sets the designated parameter to the given <code>java.math.BigDecimal</code> value.
  143. * The driver converts this to an SQL <code>NUMERIC</code> value when
  144. * it sends it to the database.
  145. *
  146. * @param parameterIndex the first parameter is 1, the second is 2, ...
  147. * @param x the parameter value
  148. * @exception SQLException if a database access error occurs
  149. */
  150. void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException;
  151. /**
  152. * Sets the designated parameter to the given Java <code>String</code> value.
  153. * The driver converts this
  154. * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
  155. * (depending on the argument's
  156. * size relative to the driver's limits on <code>VARCHAR</code> values)
  157. * when it sends it to the database.
  158. *
  159. * @param parameterIndex the first parameter is 1, the second is 2, ...
  160. * @param x the parameter value
  161. * @exception SQLException if a database access error occurs
  162. */
  163. void setString(int parameterIndex, String x) throws SQLException;
  164. /**
  165. * Sets the designated parameter to the given Java array of bytes. The driver converts
  166. * this to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code>
  167. * (depending on the argument's size relative to the driver's limits on
  168. * <code>VARBINARY</code> values) when it sends it to the database.
  169. *
  170. * @param parameterIndex the first parameter is 1, the second is 2, ...
  171. * @param x the parameter value
  172. * @exception SQLException if a database access error occurs
  173. */
  174. void setBytes(int parameterIndex, byte x[]) throws SQLException;
  175. /**
  176. * Sets the designated parameter to the given <code>java.sql.Date</code> value.
  177. * The driver converts this
  178. * to an SQL <code>DATE</code> value when it sends it to the database.
  179. *
  180. * @param parameterIndex the first parameter is 1, the second is 2, ...
  181. * @param x the parameter value
  182. * @exception SQLException if a database access error occurs
  183. */
  184. void setDate(int parameterIndex, java.sql.Date x)
  185. throws SQLException;
  186. /**
  187. * Sets the designated parameter to the given <code>java.sql.Time</code> value.
  188. * The driver converts this
  189. * to an SQL <code>TIME</code> value when it sends it to the database.
  190. *
  191. * @param parameterIndex the first parameter is 1, the second is 2, ...
  192. * @param x the parameter value
  193. * @exception SQLException if a database access error occurs
  194. */
  195. void setTime(int parameterIndex, java.sql.Time x)
  196. throws SQLException;
  197. /**
  198. * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.
  199. * The driver
  200. * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
  201. * database.
  202. *
  203. * @param parameterIndex the first parameter is 1, the second is 2, ...
  204. * @param x the parameter value
  205. * @exception SQLException if a database access error occurs
  206. */
  207. void setTimestamp(int parameterIndex, java.sql.Timestamp x)
  208. throws SQLException;
  209. /**
  210. * Sets the designated parameter to the given input stream, which will have
  211. * the specified number of bytes.
  212. * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
  213. * parameter, it may be more practical to send it via a
  214. * <code>java.io.InputStream</code>. Data will be read from the stream
  215. * as needed until end-of-file is reached. The JDBC driver will
  216. * do any necessary conversion from ASCII to the database char format.
  217. *
  218. * <P><B>Note:</B> This stream object can either be a standard
  219. * Java stream object or your own subclass that implements the
  220. * standard interface.
  221. *
  222. * @param parameterIndex the first parameter is 1, the second is 2, ...
  223. * @param x the Java input stream that contains the ASCII parameter value
  224. * @param length the number of bytes in the stream
  225. * @exception SQLException if a database access error occurs
  226. */
  227. void setAsciiStream(int parameterIndex, java.io.InputStream x, int length)
  228. throws SQLException;
  229. /**
  230. * Sets the designated parameter to the given input stream, which
  231. * will have the specified number of bytes. A Unicode character has
  232. * two bytes, with the first byte being the high byte, and the second
  233. * being the low byte.
  234. *
  235. * When a very large Unicode value is input to a <code>LONGVARCHAR</code>
  236. * parameter, it may be more practical to send it via a
  237. * <code>java.io.InputStream</code> object. The data will be read from the
  238. * stream as needed until end-of-file is reached. The JDBC driver will
  239. * do any necessary conversion from Unicode to the database char format.
  240. *
  241. * <P><B>Note:</B> This stream object can either be a standard
  242. * Java stream object or your own subclass that implements the
  243. * standard interface.
  244. *
  245. * @param parameterIndex the first parameter is 1, the second is 2, ...
  246. * @param x a <code>java.io.InputStream</code> object that contains the
  247. * Unicode parameter value as two-byte Unicode characters
  248. * @param length the number of bytes in the stream
  249. * @exception SQLException if a database access error occurs
  250. * @deprecated
  251. */
  252. void setUnicodeStream(int parameterIndex, java.io.InputStream x,
  253. int length) throws SQLException;
  254. /**
  255. * Sets the designated parameter to the given input stream, which will have
  256. * the specified number of bytes.
  257. * When a very large binary value is input to a <code>LONGVARBINARY</code>
  258. * parameter, it may be more practical to send it via a
  259. * <code>java.io.InputStream</code> object. The data will be read from the
  260. * stream as needed until end-of-file is reached.
  261. *
  262. * <P><B>Note:</B> This stream object can either be a standard
  263. * Java stream object or your own subclass that implements the
  264. * standard interface.
  265. *
  266. * @param parameterIndex the first parameter is 1, the second is 2, ...
  267. * @param x the java input stream which contains the binary parameter value
  268. * @param length the number of bytes in the stream
  269. * @exception SQLException if a database access error occurs
  270. */
  271. void setBinaryStream(int parameterIndex, java.io.InputStream x,
  272. int length) throws SQLException;
  273. /**
  274. * Clears the current parameter values immediately.
  275. * <P>In general, parameter values remain in force for repeated use of a
  276. * statement. Setting a parameter value automatically clears its
  277. * previous value. However, in some cases it is useful to immediately
  278. * release the resources used by the current parameter values; this can
  279. * be done by calling the method <code>clearParameters</code>.
  280. *
  281. * @exception SQLException if a database access error occurs
  282. */
  283. void clearParameters() throws SQLException;
  284. //----------------------------------------------------------------------
  285. // Advanced features:
  286. /**
  287. * <p>Sets the value of the designated parameter with the given object. The second
  288. * argument must be an object type; for integral values, the
  289. * <code>java.lang</code> equivalent objects should be used.
  290. *
  291. * <p>The given Java object will be converted to the given targetSqlType
  292. * before being sent to the database.
  293. *
  294. * If the object has a custom mapping (is of a class implementing the
  295. * interface <code>SQLData</code>),
  296. * the JDBC driver should call the method <code>SQLData.writeSQL</code> to
  297. * write it to the SQL data stream.
  298. * If, on the other hand, the object is of a class implementing
  299. * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
  300. * or <code>Array</code>, the driver should pass it to the database as a
  301. * value of the corresponding SQL type.
  302. *
  303. * <p>Note that this method may be used to pass database-specific
  304. * abstract data types.
  305. *
  306. * @param parameterIndex the first parameter is 1, the second is 2, ...
  307. * @param x the object containing the input parameter value
  308. * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
  309. * sent to the database. The scale argument may further qualify this type.
  310. * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
  311. * this is the number of digits after the decimal point. For all other
  312. * types, this value will be ignored.
  313. * @exception SQLException if a database access error occurs
  314. * @see Types
  315. */
  316. void setObject(int parameterIndex, Object x, int targetSqlType, int scale)
  317. throws SQLException;
  318. /**
  319. * Sets the value of the designated parameter with the given object.
  320. * This method is like the method <code>setObject</code>
  321. * above, except that it assumes a scale of zero.
  322. *
  323. * @param parameterIndex the first parameter is 1, the second is 2, ...
  324. * @param x the object containing the input parameter value
  325. * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
  326. * sent to the database
  327. * @exception SQLException if a database access error occurs
  328. */
  329. void setObject(int parameterIndex, Object x, int targetSqlType)
  330. throws SQLException;
  331. /**
  332. * <p>Sets the value of the designated parameter using the given object.
  333. * The second parameter must be of type <code>Object</code> therefore, the
  334. * <code>java.lang</code> equivalent objects should be used for built-in types.
  335. *
  336. * <p>The JDBC specification specifies a standard mapping from
  337. * Java <code>Object</code> types to SQL types. The given argument
  338. * will be converted to the corresponding SQL type before being
  339. * sent to the database.
  340. *
  341. * <p>Note that this method may be used to pass datatabase-
  342. * specific abstract data types, by using a driver-specific Java
  343. * type.
  344. *
  345. * If the object is of a class implementing the interface <code>SQLData</code>,
  346. * the JDBC driver should call the method <code>SQLData.writeSQL</code>
  347. * to write it to the SQL data stream.
  348. * If, on the other hand, the object is of a class implementing
  349. * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
  350. * or <code>Array</code>, the driver should pass it to the database as a
  351. * value of the corresponding SQL type.
  352. * <P>
  353. * This method throws an exception if there is an ambiguity, for example, if the
  354. * object is of a class implementing more than one of the interfaces named above.
  355. *
  356. * @param parameterIndex the first parameter is 1, the second is 2, ...
  357. * @param x the object containing the input parameter value
  358. * @exception SQLException if a database access error occurs or the type
  359. * of the given object is ambiguous
  360. */
  361. void setObject(int parameterIndex, Object x) throws SQLException;
  362. /**
  363. * Executes the SQL statement in this <code>PreparedStatement</code> object,
  364. * which may be any kind of SQL statement.
  365. * Some prepared statements return multiple results; the <code>execute</code>
  366. * method handles these complex statements as well as the simpler
  367. * form of statements handled by the methods <code>executeQuery</code>
  368. * and <code>executeUpdate</code>.
  369. * <P>
  370. * The <code>execute</code> method returns a <code>boolean</code> to
  371. * indicate the form of the first result. You must call either the method
  372. * <code>getResultSet</code> or <code>getUpdateCount</code>
  373. * to retrieve the result; you must call <code>getMoreResults</code> to
  374. * move to any subsequent result(s).
  375. *
  376. * @return <code>true</code> if the first result is a <code>ResultSet</code>
  377. * object; <code>false</code> if the first result is an update
  378. * count or there is no result
  379. * @exception SQLException if a database access error occurs or an argument
  380. * is supplied to this method
  381. * @see Statement#execute
  382. * @see Statement#getResultSet
  383. * @see Statement#getUpdateCount
  384. * @see Statement#getMoreResults
  385. */
  386. boolean execute() throws SQLException;
  387. //--------------------------JDBC 2.0-----------------------------
  388. /**
  389. * Adds a set of parameters to this <code>PreparedStatement</code>
  390. * object's batch of commands.
  391. *
  392. * @exception SQLException if a database access error occurs
  393. * @see Statement#addBatch
  394. * @since 1.2
  395. */
  396. void addBatch() throws SQLException;
  397. /**
  398. * Sets the designated parameter to the given <code>Reader</code>
  399. * object, which is the given number of characters long.
  400. * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
  401. * parameter, it may be more practical to send it via a
  402. * <code>java.io.Reader</code> object. The data will be read from the stream
  403. * as needed until end-of-file is reached. The JDBC driver will
  404. * do any necessary conversion from UNICODE to the database char format.
  405. *
  406. * <P><B>Note:</B> This stream object can either be a standard
  407. * Java stream object or your own subclass that implements the
  408. * standard interface.
  409. *
  410. * @param parameterIndex the first parameter is 1, the second is 2, ...
  411. * @param reader the <code>java.io.Reader</code> object that contains the
  412. * Unicode data
  413. * @param length the number of characters in the stream
  414. * @exception SQLException if a database access error occurs
  415. * @since 1.2
  416. */
  417. void setCharacterStream(int parameterIndex,
  418. java.io.Reader reader,
  419. int length) throws SQLException;
  420. /**
  421. * Sets the designated parameter to the given
  422. * <code>REF(<structured-type>)</code> value.
  423. * The driver converts this to an SQL <code>REF</code> value when it
  424. * sends it to the database.
  425. *
  426. * @param i the first parameter is 1, the second is 2, ...
  427. * @param x an SQL <code>REF</code> value
  428. * @exception SQLException if a database access error occurs
  429. * @since 1.2
  430. */
  431. void setRef (int i, Ref x) throws SQLException;
  432. /**
  433. * Sets the designated parameter to the given <code>Blob</code> object.
  434. * The driver converts this to an SQL <code>BLOB</code> value when it
  435. * sends it to the database.
  436. *
  437. * @param i the first parameter is 1, the second is 2, ...
  438. * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
  439. * @exception SQLException if a database access error occurs
  440. * @since 1.2
  441. */
  442. void setBlob (int i, Blob x) throws SQLException;
  443. /**
  444. * Sets the designated parameter to the given <code>Clob</code> object.
  445. * The driver converts this to an SQL <code>CLOB</code> value when it
  446. * sends it to the database.
  447. *
  448. * @param i the first parameter is 1, the second is 2, ...
  449. * @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
  450. * @exception SQLException if a database access error occurs
  451. * @since 1.2
  452. */
  453. void setClob (int i, Clob x) throws SQLException;
  454. /**
  455. * Sets the designated parameter to the given <code>Array</code> object.
  456. * The driver converts this to an SQL <code>ARRAY</code> value when it
  457. * sends it to the database.
  458. *
  459. * @param i the first parameter is 1, the second is 2, ...
  460. * @param x an <code>Array</code> object that maps an SQL <code>ARRAY</code> value
  461. * @exception SQLException if a database access error occurs
  462. * @since 1.2
  463. */
  464. void setArray (int i, Array x) throws SQLException;
  465. /**
  466. * Retrieves a <code>ResultSetMetaData</code> object that contains
  467. * information about the columns of the <code>ResultSet</code> object
  468. * that will be returned when this <code>PreparedStatement</code> object
  469. * is executed.
  470. * <P>
  471. * Because a <code>PreparedStatement</code> object is precompiled, it is
  472. * possible to know about the <code>ResultSet</code> object that it will
  473. * return without having to execute it. Consequently, it is possible
  474. * to invoke the method <code>getMetaData</code> on a
  475. * <code>PreparedStatement</code> object rather than waiting to execute
  476. * it and then invoking the <code>ResultSet.getMetaData</code> method
  477. * on the <code>ResultSet</code> object that is returned.
  478. * <P>
  479. * <B>NOTE:</B> Using this method may be expensive for some drivers due
  480. * to the lack of underlying DBMS support.
  481. *
  482. * @return the description of a <code>ResultSet</code> object's columns or
  483. * <code>null</code> if the driver cannot return a
  484. * <code>ResultSetMetaData</code> object
  485. * @exception SQLException if a database access error occurs
  486. * @since 1.2
  487. */
  488. ResultSetMetaData getMetaData() throws SQLException;
  489. /**
  490. * Sets the designated parameter to the given <code>java.sql.Date</code> value,
  491. * using the given <code>Calendar</code> object. The driver uses
  492. * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
  493. * which the driver then sends to the database. With
  494. * a <code>Calendar</code> object, the driver can calculate the date
  495. * taking into account a custom timezone. If no
  496. * <code>Calendar</code> object is specified, the driver uses the default
  497. * timezone, which is that of the virtual machine running the application.
  498. *
  499. * @param parameterIndex the first parameter is 1, the second is 2, ...
  500. * @param x the parameter value
  501. * @param cal the <code>Calendar</code> object the driver will use
  502. * to construct the date
  503. * @exception SQLException if a database access error occurs
  504. * @since 1.2
  505. */
  506. void setDate(int parameterIndex, java.sql.Date x, Calendar cal)
  507. throws SQLException;
  508. /**
  509. * Sets the designated parameter to the given <code>java.sql.Time</code> value,
  510. * using the given <code>Calendar</code> object. The driver uses
  511. * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
  512. * which the driver then sends to the database. With
  513. * a <code>Calendar</code> object, the driver can calculate the time
  514. * taking into account a custom timezone. If no
  515. * <code>Calendar</code> object is specified, the driver uses the default
  516. * timezone, which is that of the virtual machine running the application.
  517. *
  518. * @param parameterIndex the first parameter is 1, the second is 2, ...
  519. * @param x the parameter value
  520. * @param cal the <code>Calendar</code> object the driver will use
  521. * to construct the time
  522. * @exception SQLException if a database access error occurs
  523. * @since 1.2
  524. */
  525. void setTime(int parameterIndex, java.sql.Time x, Calendar cal)
  526. throws SQLException;
  527. /**
  528. * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
  529. * using the given <code>Calendar</code> object. The driver uses
  530. * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
  531. * which the driver then sends to the database. With a
  532. * <code>Calendar</code> object, the driver can calculate the timestamp
  533. * taking into account a custom timezone. If no
  534. * <code>Calendar</code> object is specified, the driver uses the default
  535. * timezone, which is that of the virtual machine running the application.
  536. *
  537. * @param parameterIndex the first parameter is 1, the second is 2, ...
  538. * @param x the parameter value
  539. * @param cal the <code>Calendar</code> object the driver will use
  540. * to construct the timestamp
  541. * @exception SQLException if a database access error occurs
  542. * @since 1.2
  543. */
  544. void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal)
  545. throws SQLException;
  546. /**
  547. * Sets the designated parameter to SQL <code>NULL</code>.
  548. * This version of the method <code>setNull</code> should
  549. * be used for user-defined types and REF type parameters. Examples
  550. * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
  551. * named array types.
  552. *
  553. * <P><B>Note:</B> To be portable, applications must give the
  554. * SQL type code and the fully-qualified SQL type name when specifying
  555. * a NULL user-defined or REF parameter. In the case of a user-defined type
  556. * the name is the type name of the parameter itself. For a REF
  557. * parameter, the name is the type name of the referenced type. If
  558. * a JDBC driver does not need the type code or type name information,
  559. * it may ignore it.
  560. *
  561. * Although it is intended for user-defined and Ref parameters,
  562. * this method may be used to set a null parameter of any JDBC type.
  563. * If the parameter does not have a user-defined or REF type, the given
  564. * typeName is ignored.
  565. *
  566. *
  567. * @param paramIndex the first parameter is 1, the second is 2, ...
  568. * @param sqlType a value from <code>java.sql.Types</code>
  569. * @param typeName the fully-qualified name of an SQL user-defined type;
  570. * ignored if the parameter is not a user-defined type or REF
  571. * @exception SQLException if a database access error occurs
  572. * @since 1.2
  573. */
  574. void setNull (int paramIndex, int sqlType, String typeName)
  575. throws SQLException;
  576. //------------------------- JDBC 3.0 -----------------------------------
  577. /**
  578. * Sets the designated parameter to the given <code>java.net.URL</code> value.
  579. * The driver converts this to an SQL <code>DATALINK</code> value
  580. * when it sends it to the database.
  581. *
  582. * @param parameterIndex the first parameter is 1, the second is 2, ...
  583. * @param x the <code>java.net.URL</code> object to be set
  584. * @exception SQLException if a database access error occurs
  585. * @since 1.4
  586. */
  587. void setURL(int parameterIndex, java.net.URL x) throws SQLException;
  588. /**
  589. * Retrieves the number, types and properties of this
  590. * <code>PreparedStatement</code> object's parameters.
  591. *
  592. * @return a <code>ParameterMetaData</code> object that contains information
  593. * about the number, types and properties of this
  594. * <code>PreparedStatement</code> object's parameters
  595. * @exception SQLException if a database access error occurs
  596. * @see ParameterMetaData
  597. * @since 1.4
  598. */
  599. ParameterMetaData getParameterMetaData() throws SQLException;
  600. }