KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > rmijdbc > RJConnectionInterface


1
2 /**
3  * RmiJdbc client/server JDBC Driver
4  * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997
5  *
6  * @version 1.0
7  * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com)
8  */

9
10 package org.objectweb.rmijdbc;
11
12 import java.sql.*;
13 //import javax.transaction.xa.*;
14

15 /**
16  * <P>A Connection represents a session with a specific
17  * database. Within the context of a Connection, SQL statements are
18  * executed and results are returned.
19  *
20  * <P>A Connection's database is able to provide information
21  * describing its tables, its supported SQL grammar, its stored
22  * procedures, the capabilities of this connection, etc. This
23  * information is obtained with the getMetaData method.
24  *
25  * <P><B>Note:</B> By default the Connection automatically commits
26  * changes after executing each statement. If auto commit has been
27  * disabled, an explicit commit must be done or database changes will
28  * not be saved.
29  *
30  * @see DriverManager#getConnection
31  * @see Statement
32  * @see ResultSet
33  * @see DatabaseMetaData
34  */

35 public interface RJConnectionInterface extends java.rmi.Remote JavaDoc
36 {
37
38     /**
39      * SQL statements without parameters are normally
40      * executed using Statement objects. If the same SQL statement
41      * is executed many times, it is more efficient to use a
42      * PreparedStatement
43      *
44      * @return a new Statement object
45      */

46   RJStatementInterface createStatement()
47   throws java.rmi.RemoteException JavaDoc, SQLException;
48
49     /**
50      * A SQL statement with or without IN parameters can be
51      * pre-compiled and stored in a PreparedStatement object. This
52      * object can then be used to efficiently execute this statement
53      * multiple times.
54      *
55      * <P><B>Note:</B> This method is optimized for handling
56      * parametric SQL statements that benefit from precompilation. If
57      * the driver supports precompilation, prepareStatement will send
58      * the statement to the database for precompilation. Some drivers
59      * may not support precompilation. In this case, the statement may
60      * not be sent to the database until the PreparedStatement is
61      * executed. This has no direct affect on users; however, it does
62      * affect which method throws certain SQLExceptions.
63      *
64      * @param sql a SQL statement that may contain one or more '?' IN
65      * parameter placeholders
66      *
67      * @return a new PreparedStatement object containing the
68      * pre-compiled statement
69      */

70   RJPreparedStatementInterface prepareStatement(String JavaDoc sql)
71   throws java.rmi.RemoteException JavaDoc, SQLException;
72
73     /**
74      * A SQL stored procedure call statement is handled by creating a
75      * CallableStatement for it. The CallableStatement provides
76      * methods for setting up its IN and OUT parameters, and
77      * methods for executing it.
78      *
79      * <P><B>Note:</B> This method is optimized for handling stored
80      * procedure call statements. Some drivers may send the call
81      * statement to the database when the prepareCall is done; others
82      * may wait until the CallableStatement is executed. This has no
83      * direct affect on users; however, it does affect which method
84      * throws certain java.rmi.RemoteExceptions.
85      *
86      * @param sql a SQL statement that may contain one or more '?'
87      * parameter placeholders. Typically this statement is a JDBC
88      * function call escape string.
89      *
90      * @return a new CallableStatement object containing the
91      * pre-compiled SQL statement
92      */

93   RJCallableStatementInterface prepareCall(String JavaDoc sql)
94   throws java.rmi.RemoteException JavaDoc, SQLException;
95
96     /**
97      * A driver may convert the JDBC sql grammar into its system's
98      * native SQL grammar prior to sending it; nativeSQL returns the
99      * native form of the statement that the driver would have sent.
100      *
101      * @param sql a SQL statement that may contain one or more '?'
102      * parameter placeholders
103      *
104      * @return the native form of this statement
105      */

106   String JavaDoc nativeSQL(String JavaDoc sql) throws java.rmi.RemoteException JavaDoc, SQLException;
107
108     /**
109      * If a connection is in auto-commit mode, then all its SQL
110      * statements will be executed and committed as individual
111      * transactions. Otherwise, its SQL statements are grouped into
112      * transactions that are terminated by either commit() or
113      * rollback(). By default, new connections are in auto-commit
114      * mode.
115      *
116      * The commit occurs when the statement completes or the next
117      * execute occurs, whichever comes first. In the case of
118      * statements returning a ResultSet, the statement completes when
119      * the last row of the ResultSet has been retrieved or the
120      * ResultSet has been closed. In advanced cases, a single
121      * statement may return multiple results as well as output
122      * parameter values. Here the commit occurs when all results and
123      * output param values have been retrieved.
124      *
125      * @param autoCommit true enables auto-commit; false disables
126      * auto-commit.
127      */

128   void setAutoCommit(boolean autoCommit)
129   throws java.rmi.RemoteException JavaDoc, SQLException;
130
131     /**
132      * Get the current auto-commit state.
133      * @return Current state of auto-commit mode.
134      * @see #setAutoCommit
135      */

136   boolean getAutoCommit() throws java.rmi.RemoteException JavaDoc, SQLException;
137
138     /**
139      * Commit makes all changes made since the previous
140      * commit/rollback permanent and releases any database locks
141      * currently held by the Connection. This method should only be
142      * used when auto commit has been disabled.
143      *
144      * @see #setAutoCommit
145      */

146   void commit() throws java.rmi.RemoteException JavaDoc, SQLException;
147
148     /**
149      * Rollback drops all changes made since the previous
150      * commit/rollback and releases any database locks currently held
151      * by the Connection. This method should only be used when auto
152      * commit has been disabled.
153      *
154      * @see #setAutoCommit
155      */

156   void rollback() throws java.rmi.RemoteException JavaDoc, SQLException;
157
158     /**
159      * In some cases, it is desirable to immediately release a
160      * Connection's database and JDBC resources instead of waiting for
161      * them to be automatically released; the close method provides this
162      * immediate release.
163      *
164      * <P><B>Note:</B> A Connection is automatically closed when it is
165      * garbage collected. Certain fatal errors also result in a closed
166      * Connection.
167      */

168   void close() throws java.rmi.RemoteException JavaDoc, SQLException;
169
170     /**
171      * Tests to see if a Connection is closed.
172      *
173      * @return true if the connection is closed; false if it's still open
174      */

175   boolean isClosed() throws java.rmi.RemoteException JavaDoc, SQLException;
176
177     //======================================================================
178
// Advanced features:
179

180     /**
181      * A Connection's database is able to provide information
182      * describing its tables, its supported SQL grammar, its stored
183      * procedures, the capabilities of this connection, etc. This
184      * information is made available through a DatabaseMetaData
185      * object.
186      *
187      * @return a DatabaseMetaData object for this Connection
188      */

189   RJDatabaseMetaDataInterface getMetaData()
190   throws java.rmi.RemoteException JavaDoc, SQLException;
191
192     /**
193      * You can put a connection in read-only mode as a hint to enable
194      * database optimizations.
195      *
196      * <P><B>Note:</B> setReadOnly cannot be called while in the
197      * middle of a transaction.
198      *
199      * @param readOnly true enables read-only mode; false disables
200      * read-only mode.
201      */

202   void setReadOnly(boolean readOnly)
203   throws java.rmi.RemoteException JavaDoc, SQLException;
204
205     /**
206      * Tests to see if the connection is in read-only mode.
207      *
208      * @return true if connection is read-only
209      */

210   boolean isReadOnly() throws java.rmi.RemoteException JavaDoc, SQLException;
211
212     /**
213      * A sub-space of this Connection's database may be selected by setting a
214      * catalog name. If the driver does not support catalogs it will
215      * silently ignore this request.
216      */

217   void setCatalog(String JavaDoc catalog) throws java.rmi.RemoteException JavaDoc, SQLException;
218
219     /**
220      * Return the Connection's current catalog name.
221      *
222      * @return the current catalog name or null
223      */

224   String JavaDoc getCatalog() throws java.rmi.RemoteException JavaDoc, SQLException;
225
226     /**
227      * You can call this method to try to change the transaction
228      * isolation level using one of the TRANSACTION_* values.
229      *
230      * <P><B>Note:</B> setTransactionIsolation cannot be called while
231      * in the middle of a transaction.
232      *
233      * @param level one of the TRANSACTION_* isolation values with the
234      * exception of TRANSACTION_NONE; some databases may not support
235      * other values
236      *
237      * @see DatabaseMetaData#supportsTransactionIsolationLevel
238      */

239   void setTransactionIsolation(int level)
240   throws java.rmi.RemoteException JavaDoc, SQLException;
241
242     /**
243      * Get this Connection's current transaction isolation mode.
244      *
245      * @return the current TRANSACTION_* mode value
246      */

247   int getTransactionIsolation() throws java.rmi.RemoteException JavaDoc, SQLException;
248
249     /**
250      * The first warning reported by calls on this Connection is
251      * returned.
252      *
253      * <P><B>Note:</B> Subsequent warnings will be chained to this
254      * SQLWarning.
255      *
256      * @return the first SQLWarning or null
257      */

258   SQLWarning getWarnings() throws java.rmi.RemoteException JavaDoc, SQLException;
259
260     /**
261      * After this call, getWarnings returns null until a new warning is
262      * reported for this Connection.
263      */

264   void clearWarnings() throws java.rmi.RemoteException JavaDoc, SQLException;
265
266     //--------------------------JDBC 2.0-----------------------------
267

268     /**
269      * JDBC 2.0
270      *
271      * Creates a <code>Statement</code> object that will generate
272      * <code>ResultSet</code> objects with the given type and concurrency.
273      * This method is the same as the <code>createStatement</code> method
274      * above, but it allows the default result set
275      * type and result set concurrency type to be overridden.
276      *
277      * @param resultSetType a result set type; see ResultSet.TYPE_XXX
278      * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX
279      * @return a new Statement object
280      * @exception SQLException if a database access error occurs
281      */

282     RJStatementInterface createStatement(int resultSetType,
283     int resultSetConcurrency) throws java.rmi.RemoteException JavaDoc, SQLException;
284
285     /**
286      * JDBC 2.0
287      *
288      * Creates a <code>PreparedStatement</code> object that will generate
289      * <code>ResultSet</code> objects with the given type and concurrency.
290      * This method is the same as the <code>prepareStatement</code> method
291      * above, but it allows the default result set
292      * type and result set concurrency type to be overridden.
293      *
294      * @param resultSetType a result set type; see ResultSet.TYPE_XXX
295      * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX
296      * @return a new PreparedStatement object containing the
297      * pre-compiled SQL statement
298      * @exception SQLException if a database access error occurs
299      */

300      RJPreparedStatementInterface prepareStatement(String JavaDoc sql,
301      int resultSetType, int resultSetConcurrency)
302      throws java.rmi.RemoteException JavaDoc, SQLException;
303
304     /**
305      * JDBC 2.0
306      *
307      * Creates a <code>CallableStatement</code> object that will generate
308      * <code>ResultSet</code> objects with the given type and concurrency.
309      * This method is the same as the <code>prepareCall</code> method
310      * above, but it allows the default result set
311      * type and result set concurrency type to be overridden.
312      *
313      * @param resultSetType a result set type; see ResultSet.TYPE_XXX
314      * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX
315      * @return a new CallableStatement object containing the
316      * pre-compiled SQL statement
317      * @exception SQLException if a database access error occurs
318      */

319     RJCallableStatementInterface prepareCall(String JavaDoc sql, int resultSetType,
320     int resultSetConcurrency) throws java.rmi.RemoteException JavaDoc, SQLException;
321
322     /**
323      * JDBC 2.0
324      *
325      * Gets the type map object associated with this connection.
326      * Unless the application has added an entry to the type map,
327      * the map returned will be empty.
328      *
329      * @return the <code>java.util.Map</code> object associated
330      * with this <code>Connection</code> object
331      */

332     java.util.Map JavaDoc getTypeMap() throws java.rmi.RemoteException JavaDoc, SQLException;
333
334     /**
335      * JDBC 2.0
336      *
337      * Installs the given type map as the type map for
338      * this connection. The type map will be used for the
339      * custom mapping of SQL structured types and distinct types.
340      *
341      * @param the <code>java.util.Map</code> object to install
342      * as the replacement for this <code>Connection</code>
343      * object's default type map
344      */

345     void setTypeMap(java.util.Map JavaDoc map)
346     throws java.rmi.RemoteException JavaDoc, SQLException;
347
348     /**
349          ** TBD XA
350      * Informs a connection that it is now part of a Global
351      * transaction.
352     void startGlobalTransaction (Xid xid) throws java.rmi.RemoteException, XAException;
353      */

354
355   //--------------------------JDBC 3.0-----------------------------
356

357
358     /**
359      * Changes the holdability of <code>ResultSet</code> objects
360      * created using this <code>Connection</code> object to the given
361      * holdability.
362      *
363      * @param holdability a <code>ResultSet</code> holdability constant; one of
364      * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
365      * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
366      * @throws SQLException if a database access occurs, the given parameter
367      * is not a <code>ResultSet</code> constant indicating holdability,
368      * or the given holdability is not supported
369      * @see #getHoldability
370      * @see ResultSet
371      * @since 1.4
372      */

373   void setHoldability(int holdability) throws java.rmi.RemoteException JavaDoc, SQLException;
374
375     /**
376      * Retrieves the current holdability of <code>ResultSet</code> objects
377      * created using this <code>Connection</code> object.
378      *
379      * @return the holdability, one of
380      * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
381      * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
382      * @throws SQLException if a database access occurs
383      * @see #setHoldability
384      * @see ResultSet
385      * @since 1.4
386      */

387   int getHoldability() throws java.rmi.RemoteException JavaDoc, SQLException;
388
389     /**
390      * Creates an unnamed savepoint in the current transaction and
391      * returns the new <code>Savepoint</code> object that represents it.
392      *
393      * @return the new <code>Savepoint</code> object
394      * @exception SQLException if a database access error occurs
395      * or this <code>Connection</code> object is currently in
396      * auto-commit mode
397      * @see Savepoint
398      * @since 1.4
399      */

400   RJSavepointInterface setSavepoint()
401    throws java.rmi.RemoteException JavaDoc, SQLException;
402
403     /**
404      * Creates a savepoint with the given name in the current transaction
405      * and returns the new <code>Savepoint</code> object that represents it.
406      *
407      * @param name a <code>String</code> containing the name of the savepoint
408      * @return the new <code>Savepoint</code> object
409      * @exception SQLException if a database access error occurs
410      * or this <code>Connection</code> object is currently in
411      * auto-commit mode
412      * @see Savepoint
413      * @since 1.4
414      */

415   RJSavepointInterface setSavepoint(String JavaDoc name)
416    throws java.rmi.RemoteException JavaDoc, SQLException;
417
418     /**
419      * Undoes all changes made after the given <code>Savepoint</code> object
420      * was set.
421      * <P>
422      * This method should be used only when auto-commit has been disabled.
423      *
424      * @param savepoint the <code>Savepoint</code> object to roll back to
425      * @exception SQLException if a database access error occurs,
426      * the <code>Savepoint</code> object is no longer valid,
427      * or this <code>Connection</code> object is currently in
428      * auto-commit mode
429      * @see Savepoint
430      * @see #rollback
431      * @since 1.4
432      */

433   void rollback(Savepoint savepoint) throws java.rmi.RemoteException JavaDoc, SQLException;
434
435     /**
436      * Removes the given <code>Savepoint</code> object from the current
437      * transaction. Any reference to the savepoint after it have been removed
438      * will cause an <code>SQLException</code> to be thrown.
439      *
440      * @param savepoint the <code>Savepoint</code> object to be removed
441      * @exception SQLException if a database access error occurs or
442      * the given <code>Savepoint</code> object is not a valid
443      * savepoint in the current transaction
444      * @since 1.4
445      */

446   void releaseSavepoint(Savepoint savepoint) throws java.rmi.RemoteException JavaDoc, SQLException;
447
448     /**
449      * Creates a <code>Statement</code> object that will generate
450      * <code>ResultSet</code> objects with the given type, concurrency,
451      * and holdability.
452      * This method is the same as the <code>createStatement</code> method
453      * above, but it allows the default result set
454      * type, concurrency, and holdability to be overridden.
455      *
456      * @param resultSetType one of the following <code>ResultSet</code>
457      * constants:
458      * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
459      * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
460      * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
461      * @param resultSetConcurrency one of the following <code>ResultSet</code>
462      * constants:
463      * <code>ResultSet.CONCUR_READ_ONLY</code> or
464      * <code>ResultSet.CONCUR_UPDATABLE</code>
465      * @param resultSetHoldability one of the following <code>ResultSet</code>
466      * constants:
467      * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
468      * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
469      * @return a new <code>Statement</code> object that will generate
470      * <code>ResultSet</code> objects with the given type,
471      * concurrency, and holdability
472      * @exception SQLException if a database access error occurs
473      * or the given parameters are not <code>ResultSet</code>
474      * constants indicating type, concurrency, and holdability
475      * @see ResultSet
476      * @since 1.4
477      */

478   RJStatementInterface createStatement(int resultSetType,
479    int resultSetConcurrency, int resultSetHoldability)
480    throws java.rmi.RemoteException JavaDoc, SQLException;
481
482     /**
483      * Creates a <code>PreparedStatement</code> object that will generate
484      * <code>ResultSet</code> objects with the given type, concurrency,
485      * and holdability.
486      * <P>
487      * This method is the same as the <code>prepareStatement</code> method
488      * above, but it allows the default result set
489      * type, concurrency, and holdability to be overridden.
490      *
491      * @param sql a <code>String</code> object that is the SQL statement to
492      * be sent to the database; may contain one or more ? IN
493      * parameters
494      * @param resultSetType one of the following <code>ResultSet</code>
495      * constants:
496      * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
497      * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
498      * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
499      * @param resultSetConcurrency one of the following <code>ResultSet</code>
500      * constants:
501      * <code>ResultSet.CONCUR_READ_ONLY</code> or
502      * <code>ResultSet.CONCUR_UPDATABLE</code>
503      * @param resultSetHoldability one of the following <code>ResultSet</code>
504      * constants:
505      * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
506      * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
507      * @return a new <code>PreparedStatement</code> object, containing the
508      * pre-compiled SQL statement, that will generate
509      * <code>ResultSet</code> objects with the given type,
510      * concurrency, and holdability
511      * @exception SQLException if a database access error occurs
512      * or the given parameters are not <code>ResultSet</code>
513      * constants indicating type, concurrency, and holdability
514      * @see ResultSet
515      * @since 1.4
516      */

517   RJPreparedStatementInterface prepareStatement(String JavaDoc sql, int resultSetType,
518    int resultSetConcurrency, int resultSetHoldability)
519    throws java.rmi.RemoteException JavaDoc, SQLException;
520
521
522     /**
523      * Creates a <code>CallableStatement</code> object that will generate
524      * <code>ResultSet</code> objects with the given type and concurrency.
525      * This method is the same as the <code>prepareCall</code> method
526      * above, but it allows the default result set
527      * type, result set concurrency type and holdability to be overridden.
528      *
529      * @param sql a <code>String</code> object that is the SQL statement to
530      * be sent to the database; may contain on or more ? parameters
531      * @param resultSetType one of the following <code>ResultSet</code>
532      * constants:
533      * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
534      * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
535      * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
536      * @param resultSetConcurrency one of the following <code>ResultSet</code>
537      * constants:
538      * <code>ResultSet.CONCUR_READ_ONLY</code> or
539      * <code>ResultSet.CONCUR_UPDATABLE</code>
540      * @param resultSetHoldability one of the following <code>ResultSet</code>
541      * constants:
542      * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
543      * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
544      * @return a new <code>CallableStatement</code> object, containing the
545      * pre-compiled SQL statement, that will generate
546      * <code>ResultSet</code> objects with the given type,
547      * concurrency, and holdability
548      * @exception SQLException if a database access error occurs
549      * or the given parameters are not <code>ResultSet</code>
550      * constants indicating type, concurrency, and holdability
551      * @see ResultSet
552      * @since 1.4
553      */

554   RJCallableStatementInterface prepareCall(String JavaDoc sql, int resultSetType,
555    int resultSetConcurrency, int resultSetHoldability)
556    throws java.rmi.RemoteException JavaDoc, SQLException;
557
558
559     /**
560      * Creates a default <code>PreparedStatement</code> object that has
561      * the capability to retrieve auto-generated keys. The given constant
562      * tells the driver whether it should make auto-generated keys
563      * available for retrieval. This parameter is ignored if the SQL
564      * statement is not an <code>INSERT</code> statement.
565      * <P>
566      * <B>Note:</B> This method is optimized for handling
567      * parametric SQL statements that benefit from precompilation. If
568      * the driver supports precompilation,
569      * the method <code>prepareStatement</code> will send
570      * the statement to the database for precompilation. Some drivers
571      * may not support precompilation. In this case, the statement may
572      * not be sent to the database until the <code>PreparedStatement</code>
573      * object is executed. This has no direct effect on users; however, it does
574      * affect which methods throw certain SQLExceptions.
575      * <P>
576      * Result sets created using the returned <code>PreparedStatement</code>
577      * object will by default be type <code>TYPE_FORWARD_ONLY</code>
578      * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
579      *
580      * @param sql an SQL statement that may contain one or more '?' IN
581      * parameter placeholders
582      * @param autoGeneratedKeys a flag indicating whether auto-generated keys
583      * should be returned; one of the following <code>Statement</code>
584      * constants:
585      * @param autoGeneratedKeys a flag indicating that auto-generated keys should be returned, one of
586      * <code>Statement.RETURN_GENERATED_KEYS</code> or
587      * <code>Statement.NO_GENERATED_KEYS</code>.
588      * @return a new <code>PreparedStatement</code> object, containing the
589      * pre-compiled SQL statement, that will have the capability of
590      * returning auto-generated keys
591      * @exception SQLException if a database access error occurs
592      * or the given parameter is not a <code>Statement</code>
593      * constant indicating whether auto-generated keys should be
594      * returned
595      * @since 1.4
596      */

597   RJPreparedStatementInterface prepareStatement(String JavaDoc sql,
598    int autoGeneratedKeys) throws java.rmi.RemoteException JavaDoc, SQLException;
599
600     /**
601      * Creates a default <code>PreparedStatement</code> object capable
602      * of returning the auto-generated keys designated by the given array.
603      * This array contains the indexes of the columns in the target
604      * table that contain the auto-generated keys that should be made
605      * available. This array is ignored if the SQL
606      * statement is not an <code>INSERT</code> statement.
607      * <P>
608      * An SQL statement with or without IN parameters can be
609      * pre-compiled and stored in a <code>PreparedStatement</code> object. This
610      * object can then be used to efficiently execute this statement
611      * multiple times.
612      * <P>
613      * <B>Note:</B> This method is optimized for handling
614      * parametric SQL statements that benefit from precompilation. If
615      * the driver supports precompilation,
616      * the method <code>prepareStatement</code> will send
617      * the statement to the database for precompilation. Some drivers
618      * may not support precompilation. In this case, the statement may
619      * not be sent to the database until the <code>PreparedStatement</code>
620      * object is executed. This has no direct effect on users; however, it does
621      * affect which methods throw certain SQLExceptions.
622      * <P>
623      * Result sets created using the returned <code>PreparedStatement</code>
624      * object will by default be type <code>TYPE_FORWARD_ONLY</code>
625      * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
626      *
627      * @param sql an SQL statement that may contain one or more '?' IN
628      * parameter placeholders
629      * @param columnIndexes an array of column indexes indicating the columns
630      * that should be returned from the inserted row or rows
631      * @return a new <code>PreparedStatement</code> object, containing the
632      * pre-compiled statement, that is capable of returning the
633      * auto-generated keys designated by the given array of column
634      * indexes
635      * @exception SQLException if a database access error occurs
636      *
637      * @since 1.4
638      */

639   RJPreparedStatementInterface prepareStatement(String JavaDoc sql, int columnIndexes[])
640    throws java.rmi.RemoteException JavaDoc, SQLException;
641
642     /**
643      * Creates a default <code>PreparedStatement</code> object capable
644      * of returning the auto-generated keys designated by the given array.
645      * This array contains the names of the columns in the target
646      * table that contain the auto-generated keys that should be returned.
647      * This array is ignored if the SQL
648      * statement is not an <code>INSERT</code> statement.
649      * <P>
650      * An SQL statement with or without IN parameters can be
651      * pre-compiled and stored in a <code>PreparedStatement</code> object. This
652      * object can then be used to efficiently execute this statement
653      * multiple times.
654      * <P>
655      * <B>Note:</B> This method is optimized for handling
656      * parametric SQL statements that benefit from precompilation. If
657      * the driver supports precompilation,
658      * the method <code>prepareStatement</code> will send
659      * the statement to the database for precompilation. Some drivers
660      * may not support precompilation. In this case, the statement may
661      * not be sent to the database until the <code>PreparedStatement</code>
662      * object is executed. This has no direct effect on users; however, it does
663      * affect which methods throw certain SQLExceptions.
664      * <P>
665      * Result sets created using the returned <code>PreparedStatement</code>
666      * object will by default be type <code>TYPE_FORWARD_ONLY</code>
667      * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
668      *
669      * @param sql an SQL statement that may contain one or more '?' IN
670      * parameter placeholders
671      * @param columnNames an array of column names indicating the columns
672      * that should be returned from the inserted row or rows
673      * @return a new <code>PreparedStatement</code> object, containing the
674      * pre-compiled statement, that is capable of returning the
675      * auto-generated keys designated by the given array of column
676      * names
677      * @exception SQLException if a database access error occurs
678      *
679      * @since 1.4
680      */

681   RJPreparedStatementInterface prepareStatement(String JavaDoc sql,
682    String JavaDoc columnNames[]) throws java.rmi.RemoteException JavaDoc, SQLException;
683          
684 };
685
686
Popular Tags