1. /*
  2. * @(#)PreparedStatement.java 1.44 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. * 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. @Deprecated
  253. void setUnicodeStream(int parameterIndex, java.io.InputStream x,
  254. int length) throws SQLException;
  255. /**
  256. * Sets the designated parameter to the given input stream, which will have
  257. * the specified number of bytes.
  258. * When a very large binary value is input to a <code>LONGVARBINARY</code>
  259. * parameter, it may be more practical to send it via a
  260. * <code>java.io.InputStream</code> object. The data will be read from the
  261. * stream as needed until end-of-file is reached.
  262. *
  263. * <P><B>Note:</B> This stream object can either be a standard
  264. * Java stream object or your own subclass that implements the
  265. * standard interface.
  266. *
  267. * @param parameterIndex the first parameter is 1, the second is 2, ...
  268. * @param x the java input stream which contains the binary parameter value
  269. * @param length the number of bytes in the stream
  270. * @exception SQLException if a database access error occurs
  271. */
  272. void setBinaryStream(int parameterIndex, java.io.InputStream x,
  273. int length) throws SQLException;
  274. /**
  275. * Clears the current parameter values immediately.
  276. * <P>In general, parameter values remain in force for repeated use of a
  277. * statement. Setting a parameter value automatically clears its
  278. * previous value. However, in some cases it is useful to immediately
  279. * release the resources used by the current parameter values; this can
  280. * be done by calling the method <code>clearParameters</code>.
  281. *
  282. * @exception SQLException if a database access error occurs
  283. */
  284. void clearParameters() throws SQLException;
  285. //----------------------------------------------------------------------
  286. // Advanced features:
  287. /**
  288. * <p>Sets the value of the designated parameter with the given object. The second
  289. * argument must be an object type; for integral values, the
  290. * <code>java.lang</code> equivalent objects should be used.
  291. *
  292. * <p>The given Java object will be converted to the given targetSqlType
  293. * before being sent to the database.
  294. *
  295. * If the object has a custom mapping (is of a class implementing the
  296. * interface <code>SQLData</code>),
  297. * the JDBC driver should call the method <code>SQLData.writeSQL</code> to
  298. * write it to the SQL data stream.
  299. * If, on the other hand, the object is of a class implementing
  300. * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
  301. * or <code>Array</code>, the driver should pass it to the database as a
  302. * value of the corresponding SQL type.
  303. *
  304. * <p>Note that this method may be used to pass database-specific
  305. * abstract data types.
  306. *
  307. * @param parameterIndex the first parameter is 1, the second is 2, ...
  308. * @param x the object containing the input parameter value
  309. * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
  310. * sent to the database. The scale argument may further qualify this type.
  311. * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
  312. * this is the number of digits after the decimal point. For all other
  313. * types, this value will be ignored.
  314. * @exception SQLException if a database access error occurs
  315. * @see Types
  316. */
  317. void setObject(int parameterIndex, Object x, int targetSqlType, int scale)
  318. throws SQLException;
  319. /**
  320. * Sets the value of the designated parameter with the given object.
  321. * This method is like the method <code>setObject</code>
  322. * above, except that it assumes a scale of zero.
  323. *
  324. * @param parameterIndex the first parameter is 1, the second is 2, ...
  325. * @param x the object containing the input parameter value
  326. * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
  327. * sent to the database
  328. * @exception SQLException if a database access error occurs
  329. */
  330. void setObject(int parameterIndex, Object x, int targetSqlType)
  331. throws SQLException;
  332. /**
  333. * <p>Sets the value of the designated parameter using the given object.
  334. * The second parameter must be of type <code>Object</code> therefore, the
  335. * <code>java.lang</code> equivalent objects should be used for built-in types.
  336. *
  337. * <p>The JDBC specification specifies a standard mapping from
  338. * Java <code>Object</code> types to SQL types. The given argument
  339. * will be converted to the corresponding SQL type before being
  340. * sent to the database.
  341. *
  342. * <p>Note that this method may be used to pass datatabase-
  343. * specific abstract data types, by using a driver-specific Java
  344. * type.
  345. *
  346. * If the object is of a class implementing the interface <code>SQLData</code>,
  347. * the JDBC driver should call the method <code>SQLData.writeSQL</code>
  348. * to write it to the SQL data stream.
  349. * If, on the other hand, the object is of a class implementing
  350. * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
  351. * or <code>Array</code>, the driver should pass it to the database as a
  352. * value of the corresponding SQL type.
  353. * <P>
  354. * This method throws an exception if there is an ambiguity, for example, if the
  355. * object is of a class implementing more than one of the interfaces named above.
  356. *
  357. * @param parameterIndex the first parameter is 1, the second is 2, ...
  358. * @param x the object containing the input parameter value
  359. * @exception SQLException if a database access error occurs or the type
  360. * of the given object is ambiguous
  361. */
  362. void setObject(int parameterIndex, Object x) throws SQLException;
  363. /**
  364. * Executes the SQL statement in this <code>PreparedStatement</code> object,
  365. * which may be any kind of SQL statement.
  366. * Some prepared statements return multiple results; the <code>execute</code>
  367. * method handles these complex statements as well as the simpler
  368. * form of statements handled by the methods <code>executeQuery</code>
  369. * and <code>executeUpdate</code>.
  370. * <P>
  371. * The <code>execute</code> method returns a <code>boolean</code> to
  372. * indicate the form of the first result. You must call either the method
  373. * <code>getResultSet</code> or <code>getUpdateCount</code>
  374. * to retrieve the result; you must call <code>getMoreResults</code> to
  375. * move to any subsequent result(s).
  376. *
  377. * @return <code>true</code> if the first result is a <code>ResultSet</code>
  378. * object; <code>false</code> if the first result is an update
  379. * count or there is no result
  380. * @exception SQLException if a database access error occurs or an argument
  381. * is supplied to this method
  382. * @see Statement#execute
  383. * @see Statement#getResultSet
  384. * @see Statement#getUpdateCount
  385. * @see Statement#getMoreResults
  386. */
  387. boolean execute() throws SQLException;
  388. //--------------------------JDBC 2.0-----------------------------
  389. /**
  390. * Adds a set of parameters to this <code>PreparedStatement</code>
  391. * object's batch of commands.
  392. *
  393. * @exception SQLException if a database access error occurs
  394. * @see Statement#addBatch
  395. * @since 1.2
  396. */
  397. void addBatch() throws SQLException;
  398. /**
  399. * Sets the designated parameter to the given <code>Reader</code>
  400. * object, which is the given number of characters long.
  401. * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
  402. * parameter, it may be more practical to send it via a
  403. * <code>java.io.Reader</code> object. The data will be read from the stream
  404. * as needed until end-of-file is reached. The JDBC driver will
  405. * do any necessary conversion from UNICODE to the database char format.
  406. *
  407. * <P><B>Note:</B> This stream object can either be a standard
  408. * Java stream object or your own subclass that implements the
  409. * standard interface.
  410. *
  411. * @param parameterIndex the first parameter is 1, the second is 2, ...
  412. * @param reader the <code>java.io.Reader</code> object that contains the
  413. * Unicode data
  414. * @param length the number of characters in the stream
  415. * @exception SQLException if a database access error occurs
  416. * @since 1.2
  417. */
  418. void setCharacterStream(int parameterIndex,
  419. java.io.Reader reader,
  420. int length) throws SQLException;
  421. /**
  422. * Sets the designated parameter to the given
  423. * <code>REF(<structured-type>)</code> value.
  424. * The driver converts this to an SQL <code>REF</code> value when it
  425. * sends it to the database.
  426. *
  427. * @param i the first parameter is 1, the second is 2, ...
  428. * @param x an SQL <code>REF</code> value
  429. * @exception SQLException if a database access error occurs
  430. * @since 1.2
  431. */
  432. void setRef (int i, Ref x) throws SQLException;
  433. /**
  434. * Sets the designated parameter to the given <code>Blob</code> object.
  435. * The driver converts this to an SQL <code>BLOB</code> value when it
  436. * sends it to the database.
  437. *
  438. * @param i the first parameter is 1, the second is 2, ...
  439. * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
  440. * @exception SQLException if a database access error occurs
  441. * @since 1.2
  442. */
  443. void setBlob (int i, Blob x) throws SQLException;
  444. /**
  445. * Sets the designated parameter to the given <code>Clob</code> object.
  446. * The driver converts this to an SQL <code>CLOB</code> value when it
  447. * sends it to the database.
  448. *
  449. * @param i the first parameter is 1, the second is 2, ...
  450. * @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
  451. * @exception SQLException if a database access error occurs
  452. * @since 1.2
  453. */
  454. void setClob (int i, Clob x) throws SQLException;
  455. /**
  456. * Sets the designated parameter to the given <code>Array</code> object.
  457. * The driver converts this to an SQL <code>ARRAY</code> value when it
  458. * sends it to the database.
  459. *
  460. * @param i the first parameter is 1, the second is 2, ...
  461. * @param x an <code>Array</code> object that maps an SQL <code>ARRAY</code> value
  462. * @exception SQLException if a database access error occurs
  463. * @since 1.2
  464. */
  465. void setArray (int i, Array x) throws SQLException;
  466. /**
  467. * Retrieves a <code>ResultSetMetaData</code> object that contains
  468. * information about the columns of the <code>ResultSet</code> object
  469. * that will be returned when this <code>PreparedStatement</code> object
  470. * is executed.
  471. * <P>
  472. * Because a <code>PreparedStatement</code> object is precompiled, it is
  473. * possible to know about the <code>ResultSet</code> object that it will
  474. * return without having to execute it. Consequently, it is possible
  475. * to invoke the method <code>getMetaData</code> on a
  476. * <code>PreparedStatement</code> object rather than waiting to execute
  477. * it and then invoking the <code>ResultSet.getMetaData</code> method
  478. * on the <code>ResultSet</code> object that is returned.
  479. * <P>
  480. * <B>NOTE:</B> Using this method may be expensive for some drivers due
  481. * to the lack of underlying DBMS support.
  482. *
  483. * @return the description of a <code>ResultSet</code> object's columns or
  484. * <code>null</code> if the driver cannot return a
  485. * <code>ResultSetMetaData</code> object
  486. * @exception SQLException if a database access error occurs
  487. * @since 1.2
  488. */
  489. ResultSetMetaData getMetaData() throws SQLException;
  490. /**
  491. * Sets the designated parameter to the given <code>java.sql.Date</code> value,
  492. * using the given <code>Calendar</code> object. The driver uses
  493. * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
  494. * which the driver then sends to the database. With
  495. * a <code>Calendar</code> object, the driver can calculate the date
  496. * taking into account a custom timezone. If no
  497. * <code>Calendar</code> object is specified, the driver uses the default
  498. * timezone, which is that of the virtual machine running the application.
  499. *
  500. * @param parameterIndex the first parameter is 1, the second is 2, ...
  501. * @param x the parameter value
  502. * @param cal the <code>Calendar</code> object the driver will use
  503. * to construct the date
  504. * @exception SQLException if a database access error occurs
  505. * @since 1.2
  506. */
  507. void setDate(int parameterIndex, java.sql.Date x, Calendar cal)
  508. throws SQLException;
  509. /**
  510. * Sets the designated parameter to the given <code>java.sql.Time</code> value,
  511. * using the given <code>Calendar</code> object. The driver uses
  512. * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
  513. * which the driver then sends to the database. With
  514. * a <code>Calendar</code> object, the driver can calculate the time
  515. * taking into account a custom timezone. If no
  516. * <code>Calendar</code> object is specified, the driver uses the default
  517. * timezone, which is that of the virtual machine running the application.
  518. *
  519. * @param parameterIndex the first parameter is 1, the second is 2, ...
  520. * @param x the parameter value
  521. * @param cal the <code>Calendar</code> object the driver will use
  522. * to construct the time
  523. * @exception SQLException if a database access error occurs
  524. * @since 1.2
  525. */
  526. void setTime(int parameterIndex, java.sql.Time x, Calendar cal)
  527. throws SQLException;
  528. /**
  529. * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
  530. * using the given <code>Calendar</code> object. The driver uses
  531. * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
  532. * which the driver then sends to the database. With a
  533. * <code>Calendar</code> object, the driver can calculate the timestamp
  534. * taking into account a custom timezone. If no
  535. * <code>Calendar</code> object is specified, the driver uses the default
  536. * timezone, which is that of the virtual machine running the application.
  537. *
  538. * @param parameterIndex the first parameter is 1, the second is 2, ...
  539. * @param x the parameter value
  540. * @param cal the <code>Calendar</code> object the driver will use
  541. * to construct the timestamp
  542. * @exception SQLException if a database access error occurs
  543. * @since 1.2
  544. */
  545. void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal)
  546. throws SQLException;
  547. /**
  548. * Sets the designated parameter to SQL <code>NULL</code>.
  549. * This version of the method <code>setNull</code> should
  550. * be used for user-defined types and REF type parameters. Examples
  551. * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
  552. * named array types.
  553. *
  554. * <P><B>Note:</B> To be portable, applications must give the
  555. * SQL type code and the fully-qualified SQL type name when specifying
  556. * a NULL user-defined or REF parameter. In the case of a user-defined type
  557. * the name is the type name of the parameter itself. For a REF
  558. * parameter, the name is the type name of the referenced type. If
  559. * a JDBC driver does not need the type code or type name information,
  560. * it may ignore it.
  561. *
  562. * Although it is intended for user-defined and Ref parameters,
  563. * this method may be used to set a null parameter of any JDBC type.
  564. * If the parameter does not have a user-defined or REF type, the given
  565. * typeName is ignored.
  566. *
  567. *
  568. * @param paramIndex the first parameter is 1, the second is 2, ...
  569. * @param sqlType a value from <code>java.sql.Types</code>
  570. * @param typeName the fully-qualified name of an SQL user-defined type;
  571. * ignored if the parameter is not a user-defined type or REF
  572. * @exception SQLException if a database access error occurs
  573. * @since 1.2
  574. */
  575. void setNull (int paramIndex, int sqlType, String typeName)
  576. throws SQLException;
  577. //------------------------- JDBC 3.0 -----------------------------------
  578. /**
  579. * Sets the designated parameter to the given <code>java.net.URL</code> value.
  580. * The driver converts this to an SQL <code>DATALINK</code> value
  581. * when it sends it to the database.
  582. *
  583. * @param parameterIndex the first parameter is 1, the second is 2, ...
  584. * @param x the <code>java.net.URL</code> object to be set
  585. * @exception SQLException if a database access error occurs
  586. * @since 1.4
  587. */
  588. void setURL(int parameterIndex, java.net.URL x) throws SQLException;
  589. /**
  590. * Retrieves the number, types and properties of this
  591. * <code>PreparedStatement</code> object's parameters.
  592. *
  593. * @return a <code>ParameterMetaData</code> object that contains information
  594. * about the number, types and properties of this
  595. * <code>PreparedStatement</code> object's parameters
  596. * @exception SQLException if a database access error occurs
  597. * @see ParameterMetaData
  598. * @since 1.4
  599. */
  600. ParameterMetaData getParameterMetaData() throws SQLException;
  601. }