KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > jdbc > DjConnection


1 /*
2  * Copyright (c) 2001-2005 by Genimen BV (www.genimen.com) All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, is permitted provided that the following conditions are met: -
6  * Redistributions of source code must retain the above copyright notice, this
7  * list of conditions and the following disclaimer. - Redistributions in binary
8  * form must reproduce the above copyright notice, this list of conditions and
9  * the following disclaimer in the documentation and/or other materials
10  * provided with the distribution. - All advertising materials mentioning
11  * features or use of this software must display the following acknowledgment:
12  * "This product includes Djeneric." - Products derived from this software may
13  * not be called "Djeneric" nor may "Djeneric" appear in their names without
14  * prior written permission of Genimen BV. - Redistributions of any form
15  * whatsoever must retain the following acknowledgment: "This product includes
16  * Djeneric."
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL GENIMEN BV, DJENERIC.ORG, OR CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */

30
31 package com.genimen.djeneric.jdbc;
32
33 import java.sql.CallableStatement JavaDoc;
34 import java.sql.Connection JavaDoc;
35 import java.sql.DatabaseMetaData JavaDoc;
36 import java.sql.PreparedStatement JavaDoc;
37 import java.sql.ResultSet JavaDoc;
38 import java.sql.SQLException JavaDoc;
39 import java.sql.SQLWarning JavaDoc;
40 import java.sql.Savepoint JavaDoc;
41 import java.sql.Statement JavaDoc;
42 import java.util.ArrayList JavaDoc;
43 import java.util.HashMap JavaDoc;
44 import java.util.Iterator JavaDoc;
45 import java.util.List JavaDoc;
46 import java.util.Map JavaDoc;
47
48 import com.genimen.djeneric.repository.exceptions.DjenericException;
49 import com.genimen.djeneric.repository.rdbms.RdbmsPersistenceManager;
50 import com.genimen.djeneric.repository.rdbms.RdbmsSession;
51 import com.genimen.djeneric.util.DjLogger;
52
53 /**
54  * Title: DjConnection.java Description: Represents a database-connection
55  *
56  * @author Gert Rijs
57  * @version 1.0
58  */

59
60 public class DjConnection implements Connection JavaDoc
61 {
62   private static final String JavaDoc CLASSNAME = DjConnection.class.getName();
63   private RdbmsPersistenceManager _persistMan = null;
64   private RdbmsSession _session = null;
65   private DjDriver _driver = null;
66   private boolean _closed = false;
67   // private Connection _underlyingDatabaseConnection = null;
68

69   private boolean _isClosing = false;
70   private List JavaDoc _allStatements = new ArrayList JavaDoc();
71
72   /**
73    * Package-private constructor, can only be instantiated by DjDriver.
74    */

75   DjConnection(DjDriver p_driver, RdbmsPersistenceManager p_mana) throws SQLException JavaDoc
76   {
77     _driver = p_driver;
78     _persistMan = p_mana;
79     try
80     {
81       _session = (RdbmsSession) _persistMan.createSession();
82     }
83     catch (DjenericException ex)
84     {
85       DjLogger.log(ex);
86       throw new SQLException JavaDoc(ex.toString());
87     }
88   }
89
90   public Statement JavaDoc createStatement() throws SQLException JavaDoc
91   {
92     DjStatement stat = new DjStatement(this);
93     _allStatements.add(stat);
94     return stat;
95   }
96
97   public Statement JavaDoc createStatement(int resultSetType, int resultSetConcurrency) throws SQLException JavaDoc
98   {
99     DjStatement stat = new DjStatement(this, resultSetType, resultSetConcurrency);
100     _allStatements.add(stat);
101     return stat;
102   }
103
104   public PreparedStatement JavaDoc prepareStatement(String JavaDoc sql) throws SQLException JavaDoc
105   {
106     DjPreparedStatement stat = new DjPreparedStatement(this, sql);
107     _allStatements.add(stat);
108     return stat;
109   }
110
111   public CallableStatement JavaDoc prepareCall(String JavaDoc sql) throws SQLException JavaDoc
112   {
113     throw new SQLException JavaDoc("djeneric doesn't support callable statements");
114   }
115
116   public String JavaDoc nativeSQL(String JavaDoc sql) throws SQLException JavaDoc
117   {
118     String JavaDoc st = translateSqlToPolymorph(sql);
119     return st;
120   }
121
122   public void setAutoCommit(boolean autoCommit) throws SQLException JavaDoc
123   {
124     throw new SQLException JavaDoc("setAutoCommit not implemented");
125   }
126
127   public boolean getAutoCommit() throws SQLException JavaDoc
128   {
129     return false;
130   }
131
132   public void commit() throws SQLException JavaDoc
133   {
134     try
135     {
136       _session.commit();
137     }
138     catch (DjenericException ex)
139     {
140       DjLogger.log(ex);
141       throw new SQLException JavaDoc(ex.toString());
142     }
143   }
144
145   public void rollback() throws SQLException JavaDoc
146   {
147     try
148     {
149       _session.rollback();
150     }
151     catch (DjenericException ex)
152     {
153       DjLogger.log(ex);
154       throw new SQLException JavaDoc(ex.toString());
155     }
156   }
157
158   public void close() throws SQLException JavaDoc
159   {
160     if (_closed) return;
161     _isClosing = true;
162     Iterator JavaDoc it = _allStatements.iterator();
163     while (it.hasNext())
164     {
165       Object JavaDoc stat = it.next();
166       if (stat instanceof DjStatement) ((DjStatement) stat).close();
167       else ((DjPreparedStatement) stat).close();
168     }
169     _closed = true;
170     _allStatements.clear();
171     _session.close();
172     _persistMan.close();
173     _driver.disconnect(this);
174   }
175
176   protected void finalize()
177   {
178     try
179     {
180       super.finalize();
181       close();
182     }
183     catch (Throwable JavaDoc e)
184     {
185     }
186   }
187
188   public boolean isClosed() throws SQLException JavaDoc
189   {
190     return _closed;
191   }
192
193   public DatabaseMetaData JavaDoc getMetaData() throws SQLException JavaDoc
194   {
195     return new DjDatabaseMetaData(this);
196   }
197
198   public void setReadOnly(boolean readOnly) throws SQLException JavaDoc
199   {
200     if (readOnly == false) throw new SQLException JavaDoc("djeneric driver must be readonly!");
201   }
202
203   public boolean isReadOnly() throws SQLException JavaDoc
204   {
205     return true;
206   }
207
208   public void setCatalog(String JavaDoc catalog) throws SQLException JavaDoc
209   {
210     throw new SQLException JavaDoc("No catalog!");
211   }
212
213   public String JavaDoc getCatalog() throws SQLException JavaDoc
214   {
215     return "";
216   }
217
218   public void setTransactionIsolation(int level) throws SQLException JavaDoc
219   {
220     throw new SQLException JavaDoc("No transaction isolation!");
221   }
222
223   public int getTransactionIsolation() throws SQLException JavaDoc
224   {
225     return 0;
226   }
227
228   public SQLWarning JavaDoc getWarnings() throws SQLException JavaDoc
229   {
230     return null;
231   }
232
233   public void clearWarnings() throws SQLException JavaDoc
234   {
235   }
236
237   public PreparedStatement JavaDoc prepareStatement(String JavaDoc sql, int resultSetType, int resultSetConcurrency)
238       throws SQLException JavaDoc
239   {
240     DjPreparedStatement stat = new DjPreparedStatement(this, sql, resultSetType, resultSetConcurrency);
241     _allStatements.add(stat);
242     return stat;
243   }
244
245   public CallableStatement JavaDoc prepareCall(String JavaDoc sql, int resultSetType, int resultSetConcurrency) throws SQLException JavaDoc
246   {
247     throw new SQLException JavaDoc("prepareCall: this method is not implemented by the djeneric driver");
248   }
249
250   public Map JavaDoc getTypeMap() throws SQLException JavaDoc
251   {
252     return new HashMap JavaDoc();
253   }
254
255   public void setTypeMap(Map JavaDoc map) throws SQLException JavaDoc
256   {
257   }
258
259   public String JavaDoc toString()
260   {
261     StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
262     sb.append(CLASSNAME + "\n Connected to " + _persistMan.toString());
263     return sb.toString();
264   }
265
266   /* package */
267   void close(DjStatement p_stat)
268   {
269     if (_isClosing == false) _allStatements.remove(p_stat);
270   }
271
272   /* package */
273   void close(DjPreparedStatement p_stat)
274   {
275     if (_isClosing == false) _allStatements.remove(p_stat);
276   }
277
278   /* package */
279   String JavaDoc translateSqlToPolymorph(String JavaDoc p_sqlToTranslate) throws SQLException JavaDoc
280   {
281     try
282     {
283       if (!p_sqlToTranslate.endsWith(";")) p_sqlToTranslate = p_sqlToTranslate + ";";
284       String JavaDoc result = _persistMan.external2internalStatement(p_sqlToTranslate);
285       if (result.endsWith(";")) return result.substring(0, result.length() - 1);
286       else return result;
287     }
288     catch (DjenericException sqlc)
289     {
290       throw new SQLException JavaDoc(sqlc.getMessage());
291     }
292   }
293
294   /* package */
295   RdbmsPersistenceManager getPersistenceManager()
296   {
297     return _persistMan;
298   }
299
300   /* package */
301   DjDriver getDriver()
302   {
303     return _driver;
304   }
305
306   //jdbc 1.4
307

308   /**
309    * Changes the holdability of <code>ResultSet</code> objects created using
310    * this <code>Connection</code> object to the given holdability.
311    *
312    * @param holdability
313    * a <code>ResultSet</code> holdability constant; one of <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code>
314    * or <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
315    * @throws SQLException
316    * if a database access occurs, the given parameter is not a
317    * <code>ResultSet</code> constant indicating holdability, or
318    * the given holdability is not supported
319    * @see #getHoldability
320    * @see ResultSet
321    * @since 1.4
322    */

323   public void setHoldability(int holdability) throws SQLException JavaDoc
324   {
325     throw new SQLException JavaDoc("Not Supported");
326   }
327
328   /**
329    * Retrieves the current holdability of <code>ResultSet</code> objects
330    * created using this <code>Connection</code> object.
331    *
332    * @return the holdability, one of <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code>
333    * or <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
334    * @throws SQLException
335    * if a database access occurs
336    * @see #setHoldability
337    * @see ResultSet
338    * @since 1.4
339    */

340   public int getHoldability() throws SQLException JavaDoc
341   {
342     throw new SQLException JavaDoc("Not Supported");
343   }
344
345   /**
346    * Creates an unnamed savepoint in the current transaction and returns the
347    * new <code>Savepoint</code> object that represents it.
348    *
349    * @return the new <code>Savepoint</code> object
350    * @exception SQLException
351    * if a database access error occurs or this <code>Connection</code>
352    * object is currently in auto-commit mode
353    * @see Savepoint
354    * @since 1.4
355    */

356   public Savepoint JavaDoc setSavepoint() throws SQLException JavaDoc
357   {
358     throw new SQLException JavaDoc("Not Supported");
359   }
360
361   /**
362    * Creates a savepoint with the given name in the current transaction and
363    * returns the new <code>Savepoint</code> object that represents it.
364    *
365    * @param name
366    * a <code>String</code> containing the name of the savepoint
367    * @return the new <code>Savepoint</code> object
368    * @exception SQLException
369    * if a database access error occurs or this <code>Connection</code>
370    * object is currently in auto-commit mode
371    * @see Savepoint
372    * @since 1.4
373    */

374   public Savepoint JavaDoc setSavepoint(String JavaDoc name) throws SQLException JavaDoc
375   {
376     throw new SQLException JavaDoc("Not Supported");
377   }
378
379   /**
380    * Undoes all changes made after the given <code>Savepoint</code> object
381    * was set.
382    * <P>
383    * This method should be used only when auto-commit has been disabled.
384    *
385    * @param savepoint
386    * the <code>Savepoint</code> object to roll back to
387    * @exception SQLException
388    * if a database access error occurs, the <code>Savepoint</code>
389    * object is no longer valid, or this <code>Connection</code>
390    * object is currently in auto-commit mode
391    * @see Savepoint
392    * @see #rollback
393    * @since 1.4
394    */

395   public void rollback(Savepoint JavaDoc savepoint) throws SQLException JavaDoc
396   {
397     throw new SQLException JavaDoc("Not Supported");
398   }
399
400   /**
401    * Removes the given <code>Savepoint</code> object from the current
402    * transaction. Any reference to the savepoint after it have been removed
403    * will cause an <code>SQLException</code> to be thrown.
404    *
405    * @param savepoint
406    * the <code>Savepoint</code> object to be removed
407    * @exception SQLException
408    * if a database access error occurs or the given <code>Savepoint</code>
409    * object is not a valid savepoint in the current transaction
410    * @since 1.4
411    */

412   public void releaseSavepoint(Savepoint JavaDoc savepoint) throws SQLException JavaDoc
413   {
414     throw new SQLException JavaDoc("Not Supported");
415   }
416
417   /**
418    * Creates a <code>Statement</code> object that will generate <code>ResultSet</code>
419    * objects with the given type, concurrency, and holdability. This method is
420    * the same as the <code>createStatement</code> method above, but it allows
421    * the default result set type, concurrency, and holdability to be
422    * overridden.
423    *
424    * @param resultSetType
425    * one of the following <code>ResultSet</code> constants: <code>ResultSet.TYPE_FORWARD_ONLY</code>,
426    * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
427    * @param resultSetConcurrency
428    * one of the following <code>ResultSet</code> constants: <code>ResultSet.CONCUR_READ_ONLY</code>
429    * or <code>ResultSet.CONCUR_UPDATABLE</code>
430    * @param resultSetHoldability
431    * one of the following <code>ResultSet</code> constants: <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code>
432    * or <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
433    * @return a new <code>Statement</code> object that will generate <code>ResultSet</code>
434    * objects with the given type, concurrency, and holdability
435    * @exception SQLException
436    * if a database access error occurs or the given parameters
437    * are not <code>ResultSet</code> constants indicating type,
438    * concurrency, and holdability
439    * @see ResultSet
440    * @since 1.4
441    */

442   public Statement JavaDoc createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
443       throws SQLException JavaDoc
444   {
445     throw new SQLException JavaDoc("Not Supported");
446   }
447
448   /**
449    * Creates a <code>PreparedStatement</code> object that will generate
450    * <code>ResultSet</code> objects with the given type, concurrency, and
451    * holdability.
452    * <P>
453    * This method is the same as the <code>prepareStatement</code> method
454    * above, but it allows the default result set type, concurrency, and
455    * holdability to be overridden.
456    *
457    * @param sql
458    * a <code>String</code> object that is the SQL statement to be
459    * sent to the database; may contain one or more ? IN parameters
460    * @param resultSetType
461    * one of the following <code>ResultSet</code> constants: <code>ResultSet.TYPE_FORWARD_ONLY</code>,
462    * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
463    * @param resultSetConcurrency
464    * one of the following <code>ResultSet</code> constants: <code>ResultSet.CONCUR_READ_ONLY</code>
465    * or <code>ResultSet.CONCUR_UPDATABLE</code>
466    * @param resultSetHoldability
467    * one of the following <code>ResultSet</code> constants: <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code>
468    * or <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
469    * @return a new <code>PreparedStatement</code> object, containing the
470    * pre-compiled SQL statement, that will generate <code>ResultSet</code>
471    * objects with the given type, concurrency, and holdability
472    * @exception SQLException
473    * if a database access error occurs or the given parameters
474    * are not <code>ResultSet</code> constants indicating type,
475    * concurrency, and holdability
476    * @see ResultSet
477    * @since 1.4
478    */

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

514   public CallableStatement JavaDoc prepareCall(String JavaDoc sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
515       throws SQLException JavaDoc
516   {
517     throw new SQLException JavaDoc("Not Supported");
518   }
519
520   /**
521    * Creates a default <code>PreparedStatement</code> object that has the
522    * capability to retrieve auto-generated keys. The given constant tells the
523    * driver whether it should make auto-generated keys available for retrieval.
524    * This parameter is ignored if the SQL statement is not an <code>INSERT</code>
525    * statement.
526    * <P>
527    * <B>Note:</B> This method is optimized for handling parametric SQL
528    * statements that benefit from precompilation. If the driver supports
529    * precompilation, the method <code>prepareStatement</code> will send the
530    * statement to the database for precompilation. Some drivers may not support
531    * precompilation. In this case, the statement may not be sent to the
532    * database until the <code>PreparedStatement</code> object is executed.
533    * This has no direct effect on users; however, it does affect which methods
534    * throw certain SQLExceptions.
535    * <P>
536    * Result sets created using the returned <code>PreparedStatement</code>
537    * object will by default be type <code>TYPE_FORWARD_ONLY</code> and have a
538    * concurrency level of <code>CONCUR_READ_ONLY</code>.
539    *
540    * @param sql
541    * an SQL statement that may contain one or more '?' IN parameter
542    * placeholders
543    * @param autoGeneratedKeys
544    * a flag indicating whether auto-generated keys should be
545    * returned; one of <code>Statement.RETURN_GENERATED_KEYS</code>
546    * or <code>Statement.NO_GENERATED_KEYS</code>
547    * @return a new <code>PreparedStatement</code> object, containing the
548    * pre-compiled SQL statement, that will have the capability of
549    * returning auto-generated keys
550    * @exception SQLException
551    * if a database access error occurs or the given parameter is
552    * not a <code>Statement</code> constant indicating whether
553    * auto-generated keys should be returned
554    * @since 1.4
555    */

556   public PreparedStatement JavaDoc prepareStatement(String JavaDoc sql, int autoGeneratedKeys) throws SQLException JavaDoc
557   {
558     throw new SQLException JavaDoc("Not Supported");
559   }
560
561   /**
562    * Creates a default <code>PreparedStatement</code> object capable of
563    * returning the auto-generated keys designated by the given array. This
564    * array contains the indexes of the columns in the target table that contain
565    * the auto-generated keys that should be made available. This array is
566    * ignored if the SQL statement is not an <code>INSERT</code> statement.
567    * <P>
568    * An SQL statement with or without IN parameters can be pre-compiled and
569    * stored in a <code>PreparedStatement</code> object. This object can then
570    * be used to efficiently execute this statement multiple times.
571    * <P>
572    * <B>Note:</B> This method is optimized for handling parametric SQL
573    * statements that benefit from precompilation. If the driver supports
574    * precompilation, the method <code>prepareStatement</code> will send the
575    * statement to the database for precompilation. Some drivers may not support
576    * precompilation. In this case, the statement may not be sent to the
577    * database until the <code>PreparedStatement</code> object is executed.
578    * This has no direct effect on users; however, it does affect which methods
579    * throw certain SQLExceptions.
580    * <P>
581    * Result sets created using the returned <code>PreparedStatement</code>
582    * object will by default be type <code>TYPE_FORWARD_ONLY</code> and have a
583    * concurrency level of <code>CONCUR_READ_ONLY</code>.
584    *
585    * @param sql
586    * an SQL statement that may contain one or more '?' IN parameter
587    * placeholders
588    * @param columnIndexes
589    * an array of column indexes indicating the columns that should
590    * be returned from the inserted row or rows
591    * @return a new <code>PreparedStatement</code> object, containing the
592    * pre-compiled statement, that is capable of returning the
593    * auto-generated keys designated by the given array of column
594    * indexes
595    * @exception SQLException
596    * if a database access error occurs
597    *
598    * @since 1.4
599    */

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

643   public PreparedStatement JavaDoc prepareStatement(String JavaDoc sql, String JavaDoc columnNames[]) throws SQLException JavaDoc
644   {
645     throw new SQLException JavaDoc("Not Supported");
646   }
647
648 }
Popular Tags