Source code: com/rohanclan/ashpool/jdbc/Connection.java
1 /*
2 * Ashpool - XML Database
3 * Copyright (C) 2003 Rob Rohan
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * Connection.java
19 *
20 * Created on January 30, 2003, 7:17 PM
21 */
22
23 package com.rohanclan.ashpool.jdbc;
24
25 import java.sql.*;
26 import com.rohanclan.ashpool.core.*;
27
28 /**
29 *
30 * @author rob
31 */
32 public class Connection implements java.sql.Connection {
33
34 private ConnectionManager conMan;
35
36 /** Creates a new instance of Connection */
37 public Connection() {;}
38
39 public Connection(java.io.File datastore){
40 try{
41 this.conMan = new ConnectionManager(datastore);
42 }catch(Exception e){
43 System.err.println(e.toString());
44 }
45 }
46
47 public ConnectionManager getConnectionManager(){
48 return conMan;
49 }
50
51 /** Clears all warnings reported for this <code>Connection</code> object.
52 * After a call to this method, the method <code>getWarnings</code>
53 * returns <code>null</code> until a new warning is
54 * reported for this <code>Connection</code> object.
55 *
56 * @exception SQLException if a database access error occurs
57 *
58 */
59 public void clearWarnings() throws SQLException {;}
60
61 /** Releases this <code>Connection</code> object's database and JDBC resources
62 * immediately instead of waiting for them to be automatically released.
63 * <P>
64 * Calling the method <code>close</code> on a <code>Connection</code>
65 * object that is already closed is a no-op.
66 * <P>
67 * <B>Note:</B> A <code>Connection</code> object is automatically
68 * closed when it is garbage collected. Certain fatal errors also
69 * close a <code>Connection</code> object.
70 *
71 * @exception SQLException if a database access error occurs
72 *
73 */
74 public void close() throws SQLException {;}
75
76 /** Makes all changes made since the previous
77 * commit/rollback permanent and releases any database locks
78 * currently held by this <code>Connection</code> object.
79 * This method should be
80 * used only when auto-commit mode has been disabled.
81 *
82 * @exception SQLException if a database access error occurs or this
83 * <code>Connection</code> object is in auto-commit mode
84 * @see #setAutoCommit
85 *
86 */
87 public void commit() throws SQLException {;}
88
89 /** Creates a <code>Statement</code> object for sending
90 * SQL statements to the database.
91 * SQL statements without parameters are normally
92 * executed using <code>Statement</code> objects. If the same SQL statement
93 * is executed many times, it may be more efficient to use a
94 * <code>PreparedStatement</code> object.
95 * <P>
96 * Result sets created using the returned <code>Statement</code>
97 * object will by default be type <code>TYPE_FORWARD_ONLY</code>
98 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
99 *
100 * @return a new default <code>Statement</code> object
101 * @exception SQLException if a database access error occurs
102 *
103 */
104 public java.sql.Statement createStatement() throws SQLException {
105 com.rohanclan.ashpool.jdbc.Statement stmt = new com.rohanclan.ashpool.jdbc.Statement();
106 stmt.setConnectionManager(conMan);
107
108 return stmt;
109 }
110
111 /** Creates a <code>Statement</code> object that will generate
112 * <code>ResultSet</code> objects with the given type and concurrency.
113 * This method is the same as the <code>createStatement</code> method
114 * above, but it allows the default result set
115 * type and concurrency to be overridden.
116 *
117 * @param resultSetType a result set type; one of
118 * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
119 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
120 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
121 * @param resultSetConcurrency a concurrency type; one of
122 * <code>ResultSet.CONCUR_READ_ONLY</code> or
123 * <code>ResultSet.CONCUR_UPDATABLE</code>
124 * @return a new <code>Statement</code> object that will generate
125 * <code>ResultSet</code> objects with the given type and
126 * concurrency
127 * @exception SQLException if a database access error occurs
128 * or the given parameters are not <code>ResultSet</code>
129 * constants indicating type and concurrency
130 * @since 1.2
131 *
132 */
133 public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
134 return null;
135 }
136
137 /** Creates a <code>Statement</code> object that will generate
138 * <code>ResultSet</code> objects with the given type, concurrency,
139 * and holdability.
140 * This method is the same as the <code>createStatement</code> method
141 * above, but it allows the default result set
142 * type, concurrency, and holdability to be overridden.
143 *
144 * @param resultSetType one of the following <code>ResultSet</code>
145 * constants:
146 * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
147 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
148 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
149 * @param resultSetConcurrency one of the following <code>ResultSet</code>
150 * constants:
151 * <code>ResultSet.CONCUR_READ_ONLY</code> or
152 * <code>ResultSet.CONCUR_UPDATABLE</code>
153 * @param resultSetHoldability one of the following <code>ResultSet</code>
154 * constants:
155 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
156 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
157 * @return a new <code>Statement</code> object that will generate
158 * <code>ResultSet</code> objects with the given type,
159 * concurrency, and holdability
160 * @exception SQLException if a database access error occurs
161 * or the given parameters are not <code>ResultSet</code>
162 * constants indicating type, concurrency, and holdability
163 * @see ResultSet
164 * @since 1.4
165 *
166 */
167 public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
168 return null;
169 }
170
171 /** Retrieves the current auto-commit mode for this <code>Connection</code>
172 * object.
173 *
174 * @return the current state of this <code>Connection</code> object's
175 * auto-commit mode
176 * @exception SQLException if a database access error occurs
177 * @see #setAutoCommit
178 *
179 */
180 public boolean getAutoCommit() throws SQLException {
181 return false;
182 }
183
184 /** Retrieves this <code>Connection</code> object's current catalog name.
185 *
186 * @return the current catalog name or <code>null</code> if there is none
187 * @exception SQLException if a database access error occurs
188 * @see #setCatalog
189 *
190 */
191 public String getCatalog() throws SQLException {
192 return null;
193 }
194
195 /** Retrieves the current holdability of <code>ResultSet</code> objects
196 * created using this <code>Connection</code> object.
197 *
198 * @return the holdability, one of
199 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
200 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
201 * @throws SQLException if a database access occurs
202 * @see #setHoldability
203 * @see ResultSet
204 * @since 1.4
205 *
206 */
207 public int getHoldability() throws SQLException {
208 return ResultSet.HOLD_CURSORS_OVER_COMMIT;
209 }
210
211 /** Retrieves a <code>DatabaseMetaData</code> object that contains
212 * metadata about the database to which this
213 * <code>Connection</code> object represents a connection.
214 * The metadata includes information about the database's
215 * tables, its supported SQL grammar, its stored
216 * procedures, the capabilities of this connection, and so on.
217 *
218 * @return a <code>DatabaseMetaData</code> object for this
219 * <code>Connection</code> object
220 * @exception SQLException if a database access error occurs
221 *
222 */
223 public DatabaseMetaData getMetaData() throws SQLException {
224 return new MetaData(this);
225 }
226
227 /** Retrieves this <code>Connection</code> object's current
228 * transaction isolation level.
229 *
230 * @return the current transaction isolation level, which will be one
231 * of the following constants:
232 * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
233 * <code>Connection.TRANSACTION_READ_COMMITTED</code>,
234 * <code>Connection.TRANSACTION_REPEATABLE_READ</code>,
235 * <code>Connection.TRANSACTION_SERIALIZABLE</code>, or
236 * <code>Connection.TRANSACTION_NONE</code>.
237 * @exception SQLException if a database access error occurs
238 * @see #setTransactionIsolation
239 *
240 */
241 public int getTransactionIsolation() throws SQLException {
242 return Connection.TRANSACTION_NONE;
243 }
244
245 /** Retrieves the <code>Map</code> object associated with this
246 * <code>Connection</code> object.
247 * Unless the application has added an entry, the type map returned
248 * will be empty.
249 *
250 * @return the <code>java.util.Map</code> object associated
251 * with this <code>Connection</code> object
252 * @exception SQLException if a database access error occurs
253 * @since 1.2
254 * @see #setTypeMap
255 *
256 */
257 public java.util.Map getTypeMap() throws SQLException {
258 return null;
259 }
260
261 /** Retrieves the first warning reported by calls on this
262 * <code>Connection</code> object. If there is more than one
263 * warning, subsequent warnings will be chained to the first one
264 * and can be retrieved by calling the method
265 * <code>SQLWarning.getNextWarning</code> on the warning
266 * that was retrieved previously.
267 * <P>
268 * This method may not be
269 * called on a closed connection; doing so will cause an
270 * <code>SQLException</code> to be thrown.
271 *
272 * <P><B>Note:</B> Subsequent warnings will be chained to this
273 * SQLWarning.
274 *
275 * @return the first <code>SQLWarning</code> object or <code>null</code>
276 * if there are none
277 * @exception SQLException if a database access error occurs or
278 * this method is called on a closed connection
279 * @see SQLWarning
280 *
281 */
282 public SQLWarning getWarnings() throws SQLException {
283 return new SQLWarning();
284 }
285
286 /** Retrieves whether this <code>Connection</code> object has been
287 * closed. A connection is closed if the method <code>close</code>
288 * has been called on it or if certain fatal errors have occurred.
289 * This method is guaranteed to return <code>true</code> only when
290 * it is called after the method <code>Connection.close</code> has
291 * been called.
292 * <P>
293 * This method generally cannot be called to determine whether a
294 * connection to a database is valid or invalid. A typical client
295 * can determine that a connection is invalid by catching any
296 * exceptions that might be thrown when an operation is attempted.
297 *
298 * @return <code>true</code> if this <code>Connection</code> object
299 * is closed; <code>false</code> if it is still open
300 * @exception SQLException if a database access error occurs
301 *
302 */
303 public boolean isClosed() throws SQLException {
304 return false;
305 }
306
307 /** Retrieves whether this <code>Connection</code>
308 * object is in read-only mode.
309 *
310 * @return <code>true</code> if this <code>Connection</code> object
311 * is read-only; <code>false</code> otherwise
312 * @exception SQLException if a database access error occurs
313 *
314 */
315 public boolean isReadOnly() throws SQLException {
316 return true;
317 }
318
319 /** Converts the given SQL statement into the system's native SQL grammar.
320 * A driver may convert the JDBC SQL grammar into its system's
321 * native SQL grammar prior to sending it. This method returns the
322 * native form of the statement that the driver would have sent.
323 *
324 * @param sql an SQL statement that may contain one or more '?'
325 * parameter placeholders
326 * @return the native form of this statement
327 * @exception SQLException if a database access error occurs
328 *
329 */
330 public String nativeSQL(String sql) throws SQLException {
331 return "";
332 }
333
334 /** Creates a <code>CallableStatement</code> object for calling
335 * database stored procedures.
336 * The <code>CallableStatement</code> object provides
337 * methods for setting up its IN and OUT parameters, and
338 * methods for executing the call to a stored procedure.
339 *
340 * <P><B>Note:</B> This method is optimized for handling stored
341 * procedure call statements. Some drivers may send the call
342 * statement to the database when the method <code>prepareCall</code>
343 * is done; others
344 * may wait until the <code>CallableStatement</code> object
345 * is executed. This has no
346 * direct effect on users; however, it does affect which method
347 * throws certain SQLExceptions.
348 * <P>
349 * Result sets created using the returned <code>CallableStatement</code>
350 * object will by default be type <code>TYPE_FORWARD_ONLY</code>
351 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
352 *
353 * @param sql an SQL statement that may contain one or more '?'
354 * parameter placeholders. Typically this statement is a JDBC
355 * function call escape string.
356 * @return a new default <code>CallableStatement</code> object containing the
357 * pre-compiled SQL statement
358 * @exception SQLException if a database access error occurs
359 *
360 */
361 public CallableStatement prepareCall(String sql) throws SQLException {
362 return null;
363 }
364
365 /** Creates a <code>CallableStatement</code> object that will generate
366 * <code>ResultSet</code> objects with the given type and concurrency.
367 * This method is the same as the <code>prepareCall</code> method
368 * above, but it allows the default result set
369 * type and concurrency to be overridden.
370 *
371 * @param sql a <code>String</code> object that is the SQL statement to
372 * be sent to the database; may contain on or more ? parameters
373 * @param resultSetType a result set type; one of
374 * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
375 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
376 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
377 * @param resultSetConcurrency a concurrency type; one of
378 * <code>ResultSet.CONCUR_READ_ONLY</code> or
379 * <code>ResultSet.CONCUR_UPDATABLE</code>
380 * @return a new <code>CallableStatement</code> object containing the
381 * pre-compiled SQL statement that will produce <code>ResultSet</code>
382 * objects with the given type and concurrency
383 * @exception SQLException if a database access error occurs
384 * or the given parameters are not <code>ResultSet</code>
385 * constants indicating type and concurrency
386 * @since 1.2
387 *
388 */
389 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
390 return null;
391 }
392
393 /** Creates a <code>CallableStatement</code> object that will generate
394 * <code>ResultSet</code> objects with the given type and concurrency.
395 * This method is the same as the <code>prepareCall</code> method
396 * above, but it allows the default result set
397 * type, result set concurrency type and holdability to be overridden.
398 *
399 * @param sql a <code>String</code> object that is the SQL statement to
400 * be sent to the database; may contain on or more ? parameters
401 * @param resultSetType one of the following <code>ResultSet</code>
402 * constants:
403 * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
404 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
405 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
406 * @param resultSetConcurrency one of the following <code>ResultSet</code>
407 * constants:
408 * <code>ResultSet.CONCUR_READ_ONLY</code> or
409 * <code>ResultSet.CONCUR_UPDATABLE</code>
410 * @param resultSetHoldability one of the following <code>ResultSet</code>
411 * constants:
412 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
413 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
414 * @return a new <code>CallableStatement</code> object, containing the
415 * pre-compiled SQL statement, that will generate
416 * <code>ResultSet</code> objects with the given type,
417 * concurrency, and holdability
418 * @exception SQLException if a database access error occurs
419 * or the given parameters are not <code>ResultSet</code>
420 * constants indicating type, concurrency, and holdability
421 * @see ResultSet
422 * @since 1.4
423 *
424 */
425 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
426 return null;
427 }
428
429 /** Creates a <code>PreparedStatement</code> object for sending
430 * parameterized SQL statements to the database.
431 * <P>
432 * A SQL statement with or without IN parameters can be
433 * pre-compiled and stored in a <code>PreparedStatement</code> object. This
434 * object can then be used to efficiently execute this statement
435 * multiple times.
436 *
437 * <P><B>Note:</B> This method is optimized for handling
438 * parametric SQL statements that benefit from precompilation. If
439 * the driver supports precompilation,
440 * the method <code>prepareStatement</code> will send
441 * the statement to the database for precompilation. Some drivers
442 * may not support precompilation. In this case, the statement may
443 * not be sent to the database until the <code>PreparedStatement</code>
444 * object is executed. This has no direct effect on users; however, it does
445 * affect which methods throw certain <code>SQLException</code> objects.
446 * <P>
447 * Result sets created using the returned <code>PreparedStatement</code>
448 * object will by default be type <code>TYPE_FORWARD_ONLY</code>
449 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
450 *
451 * @param sql an SQL statement that may contain one or more '?' IN
452 * parameter placeholders
453 * @return a new default <code>PreparedStatement</code> object containing the
454 * pre-compiled SQL statement
455 * @exception SQLException if a database access error occurs
456 *
457 */
458 public PreparedStatement prepareStatement(String sql) throws SQLException {
459 return null;
460 }
461
462 /** Creates a default <code>PreparedStatement</code> object capable
463 * of returning the auto-generated keys designated by the given array.
464 * This array contains the names of the columns in the target
465 * table that contain the auto-generated keys that should be returned.
466 * This array is ignored if the SQL
467 * statement is not an <code>INSERT</code> statement.
468 * <P>
469 * An SQL statement with or without IN parameters can be
470 * pre-compiled and stored in a <code>PreparedStatement</code> object. This
471 * object can then be used to efficiently execute this statement
472 * multiple times.
473 * <P>
474 * <B>Note:</B> This method is optimized for handling
475 * parametric SQL statements that benefit from precompilation. If
476 * the driver supports precompilation,
477 * the method <code>prepareStatement</code> will send
478 * the statement to the database for precompilation. Some drivers
479 * may not support precompilation. In this case, the statement may
480 * not be sent to the database until the <code>PreparedStatement</code>
481 * object is executed. This has no direct effect on users; however, it does
482 * affect which methods throw certain SQLExceptions.
483 * <P>
484 * Result sets created using the returned <code>PreparedStatement</code>
485 * object will by default be type <code>TYPE_FORWARD_ONLY</code>
486 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
487 *
488 * @param sql an SQL statement that may contain one or more '?' IN
489 * parameter placeholders
490 * @param columnNames an array of column names indicating the columns
491 * that should be returned from the inserted row or rows
492 * @return a new <code>PreparedStatement</code> object, containing the
493 * pre-compiled statement, that is capable of returning the
494 * auto-generated keys designated by the given array of column
495 * names
496 * @exception SQLException if a database access error occurs
497 *
498 * @since 1.4
499 *
500 */
501 public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
502 return null;
503 }
504
505 /** Creates a default <code>PreparedStatement</code> object that has
506 * the capability to retrieve auto-generated keys. The given constant
507 * tells the driver whether it should make auto-generated keys
508 * available for retrieval. This parameter is ignored if the SQL
509 * statement is not an <code>INSERT</code> statement.
510 * <P>
511 * <B>Note:</B> This method is optimized for handling
512 * parametric SQL statements that benefit from precompilation. If
513 * the driver supports precompilation,
514 * the method <code>prepareStatement</code> will send
515 * the statement to the database for precompilation. Some drivers
516 * may not support precompilation. In this case, the statement may
517 * not be sent to the database until the <code>PreparedStatement</code>
518 * object is executed. This has no direct effect on users; however, it does
519 * affect which methods throw certain SQLExceptions.
520 * <P>
521 * Result sets created using the returned <code>PreparedStatement</code>
522 * object will by default be type <code>TYPE_FORWARD_ONLY</code>
523 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
524 *
525 * @param sql an SQL statement that may contain one or more '?' IN
526 * parameter placeholders
527 * @param autoGeneratedKeys a flag indicating whether auto-generated keys
528 * should be returned; one of the following <code>Statement</code>
529 * constants:
530 * @param autoGeneratedKeys a flag indicating that auto-generated keys should be returned, one of
531 * <code>Statement.RETURN_GENERATED_KEYS</code> or
532 * <code>Statement.NO_GENERATED_KEYS</code>.
533 * @return a new <code>PreparedStatement</code> object, containing the
534 * pre-compiled SQL statement, that will have the capability of
535 * returning auto-generated keys
536 * @exception SQLException if a database access error occurs
537 * or the given parameter is not a <code>Statement</code>
538 * constant indicating whether auto-generated keys should be
539 * returned
540 * @since 1.4
541 *
542 */
543 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
544 return null;
545 }
546
547 /** Creates a default <code>PreparedStatement</code> object capable
548 * of returning the auto-generated keys designated by the given array.
549 * This array contains the indexes of the columns in the target
550 * table that contain the auto-generated keys that should be made
551 * available. This array is ignored if the SQL
552 * statement is not an <code>INSERT</code> statement.
553 * <P>
554 * An SQL statement with or without IN parameters can be
555 * pre-compiled and stored in a <code>PreparedStatement</code> object. This
556 * object can then be used to efficiently execute this statement
557 * multiple times.
558 * <P>
559 * <B>Note:</B> This method is optimized for handling
560 * parametric SQL statements that benefit from precompilation. If
561 * the driver supports precompilation,
562 * the method <code>prepareStatement</code> will send
563 * the statement to the database for precompilation. Some drivers
564 * may not support precompilation. In this case, the statement may
565 * not be sent to the database until the <code>PreparedStatement</code>
566 * object is executed. This has no direct effect on users; however, it does
567 * affect which methods throw certain SQLExceptions.
568 * <P>
569 * Result sets created using the returned <code>PreparedStatement</code>
570 * object will by default be type <code>TYPE_FORWARD_ONLY</code>
571 * and have a concurrency level of <code>CONCUR_READ_ONLY</code>.
572 *
573 * @param sql an SQL statement that may contain one or more '?' IN
574 * parameter placeholders
575 * @param columnIndexes an array of column indexes indicating the columns
576 * that should be returned from the inserted row or rows
577 * @return a new <code>PreparedStatement</code> object, containing the
578 * pre-compiled statement, that is capable of returning the
579 * auto-generated keys designated by the given array of column
580 * indexes
581 * @exception SQLException if a database access error occurs
582 *
583 * @since 1.4
584 *
585 */
586 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
587 return null;
588 }
589
590 /**
591 * Creates a <code>PreparedStatement</code> object that will generate
592 * <code>ResultSet</code> objects with the given type and concurrency.
593 * This method is the same as the <code>prepareStatement</code> method
594 * above, but it allows the default result set
595 * type and concurrency to be overridden.
596 *
597 * @param sql a <code>String</code> object that is the SQL statement to
598 * be sent to the database; may contain one or more ? IN
599 * parameters
600 * @param resultSetType a result set type; one of
601 * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
602 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
603 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
604 * @param resultSetConcurrency a concurrency type; one of
605 * <code>ResultSet.CONCUR_READ_ONLY</code> or
606 * <code>ResultSet.CONCUR_UPDATABLE</code>
607 * @return a new PreparedStatement object containing the
608 * pre-compiled SQL statement that will produce <code>ResultSet</code>
609 * objects with the given type and concurrency
610 * @exception SQLException if a database access error occurs
611 * or the given parameters are not <code>ResultSet</code>
612 * constants indicating type and concurrency
613 * @since 1.2
614 *
615 */
616 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
617 return null;
618 }
619
620 /** Creates a <code>PreparedStatement</code> object that will generate
621 * <code>ResultSet</code> objects with the given type, concurrency,
622 * and holdability.
623 * <P>
624 * This method is the same as the <code>prepareStatement</code> method
625 * above, but it allows the default result set
626 * type, concurrency, and holdability to be overridden.
627 *
628 * @param sql a <code>String</code> object that is the SQL statement to
629 * be sent to the database; may contain one or more ? IN
630 * parameters
631 * @param resultSetType one of the following <code>ResultSet</code>
632 * constants:
633 * <code>ResultSet.TYPE_FORWARD_ONLY</code>,
634 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
635 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
636 * @param resultSetConcurrency one of the following <code>ResultSet</code>
637 * constants:
638 * <code>ResultSet.CONCUR_READ_ONLY</code> or
639 * <code>ResultSet.CONCUR_UPDATABLE</code>
640 * @param resultSetHoldability one of the following <code>ResultSet</code>
641 * constants:
642 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
643 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
644 * @return a new <code>PreparedStatement</code> object, containing the
645 * pre-compiled SQL statement, that will generate
646 * <code>ResultSet</code> objects with the given type,
647 * concurrency, and holdability
648 * @exception SQLException if a database access error occurs
649 * or the given parameters are not <code>ResultSet</code>
650 * constants indicating type, concurrency, and holdability
651 * @see ResultSet
652 * @since 1.4
653 *
654 */
655 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
656 return null;
657 }
658
659 /** Removes the given <code>Savepoint</code> object from the current
660 * transaction. Any reference to the savepoint after it have been removed
661 * will cause an <code>SQLException</code> to be thrown.
662 *
663 * @param savepoint the <code>Savepoint</code> object to be removed
664 * @exception SQLException if a database access error occurs or
665 * the given <code>Savepoint</code> object is not a valid
666 * savepoint in the current transaction
667 * @since 1.4
668 *
669 */
670 public void releaseSavepoint(Savepoint savepoint) throws SQLException {
671 }
672
673 /** Undoes all changes made in the current transaction
674 * and releases any database locks currently held
675 * by this <code>Connection</code> object. This method should be
676 * used only when auto-commit mode has been disabled.
677 *
678 * @exception SQLException if a database access error occurs or this
679 * <code>Connection</code> object is in auto-commit mode
680 * @see #setAutoCommit
681 *
682 */
683 public void rollback() throws SQLException {
684 }
685
686 /** Undoes all changes made after the given <code>Savepoint</code> object
687 * was set.
688 * <P>
689 * This method should be used only when auto-commit has been disabled.
690 *
691 * @param savepoint the <code>Savepoint</code> object to roll back to
692 * @exception SQLException if a database access error occurs,
693 * the <code>Savepoint</code> object is no longer valid,
694 * or this <code>Connection</code> object is currently in
695 * auto-commit mode
696 * @see Savepoint
697 * @see #rollback
698 * @since 1.4
699 *
700 */
701 public void rollback(Savepoint savepoint) throws SQLException {
702 }
703
704 /** Sets this connection's auto-commit mode to the given state.
705 * If a connection is in auto-commit mode, then all its SQL
706 * statements will be executed and committed as individual
707 * transactions. Otherwise, its SQL statements are grouped into
708 * transactions that are terminated by a call to either
709 * the method <code>commit</code> or the method <code>rollback</code>.
710 * By default, new connections are in auto-commit
711 * mode.
712 * <P>
713 * The commit occurs when the statement completes or the next
714 * execute occurs, whichever comes first. In the case of
715 * statements returning a <code>ResultSet</code> object,
716 * the statement completes when the last row of the
717 * <code>ResultSet</code> object has been retrieved or the
718 * <code>ResultSet</code> object has been closed. In advanced cases, a single
719 * statement may return multiple results as well as output
720 * parameter values. In these cases, the commit occurs when all results and
721 * output parameter values have been retrieved.
722 * <P>
723 * <B>NOTE:</B> If this method is called during a transaction, the
724 * transaction is committed.
725 *
726 * @param autoCommit <code>true</code> to enable auto-commit mode;
727 * <code>false</code> to disable it
728 * @exception SQLException if a database access error occurs
729 * @see #getAutoCommit
730 *
731 */
732 public void setAutoCommit(boolean autoCommit) throws SQLException {
733 }
734
735 /** Sets the given catalog name in order to select
736 * a subspace of this <code>Connection</code> object's database
737 * in which to work.
738 * <P>
739 * If the driver does not support catalogs, it will
740 * silently ignore this request.
741 *
742 * @param catalog the name of a catalog (subspace in this
743 * <code>Connection</code> object's database) in which to work
744 * @exception SQLException if a database access error occurs
745 * @see #getCatalog
746 *
747 */
748 public void setCatalog(String catalog) throws SQLException {
749 }
750
751 /** Changes the holdability of <code>ResultSet</code> objects
752 * created using this <code>Connection</code> object to the given
753 * holdability.
754 *
755 * @param holdability a <code>ResultSet</code> holdability constant; one of
756 * <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
757 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
758 * @throws SQLException if a database access occurs, the given parameter
759 * is not a <code>ResultSet</code> constant indicating holdability,
760 * or the given holdability is not supported
761 * @see #getHoldability
762 * @see ResultSet
763 * @since 1.4
764 *
765 */
766 public void setHoldability(int holdability) throws SQLException {
767 }
768
769 /** Puts this connection in read-only mode as a hint to the driver to enable
770 * database optimizations.
771 *
772 * <P><B>Note:</B> This method cannot be called during a transaction.
773 *
774 * @param readOnly <code>true</code> enables read-only mode;
775 * <code>false</code> disables it
776 * @exception SQLException if a database access error occurs or this
777 * method is called during a transaction
778 *
779 */
780 public void setReadOnly(boolean readOnly) throws SQLException {
781 }
782
783 /** Creates an unnamed savepoint in the current transaction and
784 * returns the new <code>Savepoint</code> object that represents it.
785 *
786 * @return the new <code>Savepoint</code> object
787 * @exception SQLException if a database access error occurs
788 * or this <code>Connection</code> object is currently in
789 * auto-commit mode
790 * @see Savepoint
791 * @since 1.4
792 *
793 */
794 public Savepoint setSavepoint() throws SQLException {
795 return null;
796 }
797
798 /** Creates a savepoint with the given name in the current transaction
799 * and returns the new <code>Savepoint</code> object that represents it.
800 *
801 * @param name a <code>String</code> containing the name of the savepoint
802 * @return the new <code>Savepoint</code> object
803 * @exception SQLException if a database access error occurs
804 * or this <code>Connection</code> object is currently in
805 * auto-commit mode
806 * @see Savepoint
807 * @since 1.4
808 *
809 */
810 public Savepoint setSavepoint(String name) throws SQLException {
811 return null;
812 }
813
814 /** Attempts to change the transaction isolation level for this
815 * <code>Connection</code> object to the one given.
816 * The constants defined in the interface <code>Connection</code>
817 * are the possible transaction isolation levels.
818 * <P>
819 * <B>Note:</B> If this method is called during a transaction, the result
820 * is implementation-defined.
821 *
822 * @param level one of the following <code>Connection</code> constants:
823 * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
824 * <code>Connection.TRANSACTION_READ_COMMITTED</code>,
825 * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
826 * <code>Connection.TRANSACTION_SERIALIZABLE</code>.
827 * (Note that <code>Connection.TRANSACTION_NONE</code> cannot be used
828 * because it specifies that transactions are not supported.)
829 * @exception SQLException if a database access error occurs
830 * or the given parameter is not one of the <code>Connection</code>
831 * constants
832 * @see DatabaseMetaData#supportsTransactionIsolationLevel
833 * @see #getTransactionIsolation
834 *
835 */
836 public void setTransactionIsolation(int level) throws SQLException {
837 }
838
839 /** Installs the given <code>TypeMap</code> object as the type map for
840 * this <code>Connection</code> object. The type map will be used for the
841 * custom mapping of SQL structured types and distinct types.
842 *
843 * @param map the <code>java.util.Map</code> object to install
844 * as the replacement for this <code>Connection</code>
845 * object's default type map
846 * @exception SQLException if a database access error occurs or
847 * the given parameter is not a <code>java.util.Map</code>
848 * object
849 * @since 1.2
850 * @see #getTypeMap
851 *
852 */
853 public void setTypeMap(java.util.Map map) throws SQLException {
854 }
855 }