KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mchange > v2 > c3p0 > PoolBackedDataSourceFactory


1 /*
2  * Distributed as part of c3p0 v.0.9.1
3  *
4  * Copyright (C) 2005 Machinery For Change, Inc.
5  *
6  * Author: Steve Waldman <swaldman@mchange.com>
7  *
8  * This library is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License version 2.1, as
10  * published by the Free Software Foundation.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this software; see the file LICENSE. If not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */

22
23
24 package com.mchange.v2.c3p0;
25
26 import java.sql.SQLException JavaDoc;
27 import javax.sql.DataSource JavaDoc;
28 import com.mchange.v2.sql.SqlUtils;
29
30 /**
31  * A class offering Factory methods for creating DataSources backed
32  * by Connection and Statement Pools.
33  *
34  * @deprecated Use the new factories in {@link com.mchange.v2.c3p0.DataSources}. See examples.
35  *
36  */

37 public final class PoolBackedDataSourceFactory
38 {
39     /**
40      * Creates a pool-backed DataSource that implements Referenceable
41      * for binding to JNDI name services. For this to work,
42      * <TT>unpooledDataSource</TT> must also implement Referenceable.
43      *
44      * @param unpooledDataSource an unpooledDataSource to use as the
45      * primary source for connections.
46      * @param minPoolSize the minimum (and starting) number of Connections
47      * that should be held in the pool.
48      * @param maxPoolSize the maximum number of Connections
49      * that should be held in the pool.
50      * @param acquireIncrement the number of Connections that should be
51      * acquired at a time when the pool runs out of Connections
52      * @param maxIdleTime the maximum number of seconds a Connection should be
53      * allowed to remain idle before it is expired from the pool.
54      * A value of 0 means Connections never expire.
55      * @param maxStatements the maximum number of PreparedStatements that should
56      * be cached by this pool. A value of 0 means that Statement caching
57      * should be disabled.
58      * @param factoryLocation a codebase url where JNDI clients can find the
59      * c3p0 libraries. Use null if clients will be expected to have the
60      * libraries available locally.
61      *
62      * @deprecated all implementations are now both Referenceable and Serializable.
63      * use create()
64      */

65     public static DataSource JavaDoc createReferenceable( DataSource JavaDoc unpooledDataSource,
66                           int minPoolSize,
67                           int maxPoolSize,
68                           int acquireIncrement,
69                           int maxIdleTime,
70                           int maxStatements,
71                           String JavaDoc factoryLocation ) throws SQLException JavaDoc
72     {
73     try
74         {
75         WrapperConnectionPoolDataSource cpds = new WrapperConnectionPoolDataSource();
76         cpds.setNestedDataSource(unpooledDataSource);
77         cpds.setMinPoolSize( minPoolSize );
78         cpds.setMaxPoolSize( maxPoolSize );
79         cpds.setAcquireIncrement( acquireIncrement );
80         cpds.setMaxIdleTime( maxIdleTime );
81         cpds.setMaxStatements( maxStatements );
82         cpds.setFactoryClassLocation( factoryLocation );
83         
84         
85         PoolBackedDataSource out = new PoolBackedDataSource();
86         out.setConnectionPoolDataSource( cpds );
87         return out;
88         }
89     catch (Exception JavaDoc e)
90         { throw SqlUtils.toSQLException( e ); }
91     }
92
93     /**
94      * Creates a pool-backed DataSource that uses default pool parameters and
95      * implements Referenceable
96      * for binding to JNDI name services. For this to work,
97      * <TT>unpooledDataSource</TT> must also implement Referenceable.
98      *
99      * @param unpooledDataSource an unpooledDataSource to use as the
100      * primary source for connections.
101      * @param factoryLocation a codebase url where JNDI clients can find the
102      * c3p0 libraries. Use null if clients will be expected to have the
103      * libraries available locally.
104      *
105      * @deprecated all implementations are now both Referenceable and Serializable.
106      * use create()
107      */

108     public static DataSource JavaDoc createReferenceable( DataSource JavaDoc unpooledDataSource,
109                           String JavaDoc factoryLocation )
110     throws SQLException JavaDoc
111     {
112     try
113         {
114         WrapperConnectionPoolDataSource cpds = new WrapperConnectionPoolDataSource();
115         cpds.setNestedDataSource(unpooledDataSource);
116         cpds.setFactoryClassLocation( factoryLocation );
117         
118         PoolBackedDataSource out = new PoolBackedDataSource();
119         out.setConnectionPoolDataSource( cpds );
120         return out;
121         }
122     catch (Exception JavaDoc e)
123         { throw SqlUtils.toSQLException( e ); }
124     }
125
126     /**
127      * Creates a pool-backed DataSource that implements Referenceable.
128      *
129      * @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.
130      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
131      * @param user a username (may be null) for authentication to the RDBMS
132      * @param password a password (may be null) for authentication to the RDBMS
133      * @param minPoolSize the minimum (and starting) number of Connections
134      * that should be held in the pool.
135      * @param maxPoolSize the maximum number of Connections
136      * that should be held in the pool.
137      * @param acquireIncrement the number of Connections that should be
138      * acquired at a time when the pool runs out of Connections
139      * @param maxIdleTime the maximum number of seconds a Connection should be
140      * allowed to remain idle before it is expired from the pool.
141      * A value of 0 means Connections never expire.
142      * @param maxStatements the maximum number of PreparedStatements that should
143      * be cached by this pool. A value of 0 means that Statement caching
144      * should be disabled.
145      * @param factoryLocation a codebase url where JNDI clients can find the
146      * c3p0 libraries. Use null if clients will be expected to have the
147      * libraries available locally.
148      *
149      * @deprecated all implementations are now both Referenceable and Serializable.
150      * use create()
151      */

152     public static DataSource JavaDoc createReferenceable(String JavaDoc jdbcDriverClass,
153                          String JavaDoc jdbcUrl,
154                          String JavaDoc user,
155                          String JavaDoc password,
156                          int minPoolSize,
157                          int maxPoolSize,
158                          int acquireIncrement,
159                          int maxIdleTime,
160                          int maxStatements,
161                          String JavaDoc factoryLocation ) throws SQLException JavaDoc
162     {
163     DataSource JavaDoc nested = DriverManagerDataSourceFactory.create( jdbcDriverClass,
164                                    jdbcUrl,
165                                    user,
166                                    password );
167     return createReferenceable( nested,
168                     minPoolSize,
169                     maxPoolSize,
170                     acquireIncrement,
171                     maxIdleTime,
172                     maxStatements,
173                     factoryLocation );
174     }
175
176     /**
177      * Creates a pool-backed DataSource that implements Referenceable and uses
178      * default pooling parameters.
179      *
180      * @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.
181      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
182      * @param user a username (may be null) for authentication to the RDBMS
183      * @param password a password (may be null) for authentication to the RDBMS
184      * @param factoryLocation a codebase url where JNDI clients can find the
185      * c3p0 libraries. Use null if clients will be expected to have the
186      * libraries available locally.
187      *
188      * @deprecated all implementations are now both Referenceable and Serializable.
189      * use create()
190      */

191     public static DataSource JavaDoc createReferenceable(String JavaDoc jdbcDriverClass,
192                          String JavaDoc jdbcUrl,
193                          String JavaDoc user,
194                          String JavaDoc password,
195                          String JavaDoc factoryLocation )
196     throws SQLException JavaDoc
197     {
198     DataSource JavaDoc nested = DriverManagerDataSourceFactory.create( jdbcDriverClass,
199                                    jdbcUrl,
200                                    user,
201                                    password );
202     return createReferenceable( nested,
203                     factoryLocation );
204     }
205
206     /**
207      * Creates a pool-backed DataSource that implements Serializable
208      * for binding to JNDI name services. For this to work,
209      * <TT>unpooledDataSource</TT> must also implement Serializable.
210      *
211      * @param unpooledDataSource an unpooledDataSource to use as the
212      * primary source for connections.
213      * @param minPoolSize the minimum (and starting) number of Connections
214      * that should be held in the pool.
215      * @param maxPoolSize the maximum number of Connections
216      * that should be held in the pool.
217      * @param acquireIncrement the number of Connections that should be
218      * acquired at a time when the pool runs out of Connections
219      * @param maxIdleTime the maximum number of seconds a Connection should be
220      * allowed to remain idle before it is expired from the pool.
221      * A value of 0 means Connections never expire.
222      * @param maxStatements the maximum number of PreparedStatements that should
223      * be cached by this pool. A value of 0 means that Statement caching
224      * should be disabled.
225      *
226      * @deprecated all implementations are now both Referenceable and Serializable.
227      * use create()
228      */

229     public static DataSource JavaDoc createSerializable( DataSource JavaDoc unpooledDataSource,
230                          int minPoolSize,
231                          int maxPoolSize,
232                          int acquireIncrement,
233                          int maxIdleTime,
234                          int maxStatements)
235     throws SQLException JavaDoc
236     {
237     try
238         {
239         WrapperConnectionPoolDataSource cpds = new WrapperConnectionPoolDataSource();
240         cpds.setNestedDataSource(unpooledDataSource);
241         cpds.setMinPoolSize( minPoolSize );
242         cpds.setMaxPoolSize( maxPoolSize );
243         cpds.setAcquireIncrement( acquireIncrement );
244         cpds.setMaxIdleTime( maxIdleTime );
245         cpds.setMaxStatements( maxStatements );
246         
247         PoolBackedDataSource out = new PoolBackedDataSource();
248         out.setConnectionPoolDataSource( cpds );
249         return out;
250         }
251     catch (Exception JavaDoc e)
252         { throw SqlUtils.toSQLException( e ); }
253     }
254
255     /**
256      * Creates a pool-backed DataSource that uses default pool parameters and
257      * implements Serializable
258      * for binding to JNDI name services. For this to work,
259      * <TT>unpooledDataSource</TT> must also implement Serializable.
260      *
261      * @param unpooledDataSource an unpooledDataSource to use as the
262      * primary source for connections.
263      *
264      * @deprecated all implementations are now both Referenceable and Serializable.
265      * use create()
266      */

267     public static DataSource JavaDoc createSerializable( DataSource JavaDoc unpooledDataSource ) throws SQLException JavaDoc
268     {
269     try
270         {
271         WrapperConnectionPoolDataSource cpds = new WrapperConnectionPoolDataSource();
272         cpds.setNestedDataSource(unpooledDataSource);
273         
274         PoolBackedDataSource out = new PoolBackedDataSource();
275         out.setConnectionPoolDataSource( cpds );
276         return out;
277         }
278     catch (Exception JavaDoc e)
279         { throw SqlUtils.toSQLException( e ); }
280     }
281
282
283     /**
284      * Creates a pool-backed DataSource that implements Serializable.
285      *
286      * @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.
287      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
288      * @param user a username (may be null) for authentication to the RDBMS
289      * @param password a password (may be null) for authentication to the RDBMS
290      * @param minPoolSize the minimum (and starting) number of Connections
291      * that should be held in the pool.
292      * @param maxPoolSize the maximum number of Connections
293      * that should be held in the pool.
294      * @param acquireIncrement the number of Connections that should be
295      * acquired at a time when the pool runs out of Connections
296      * @param maxIdleTime the maximum number of seconds a Connection should be
297      * allowed to remain idle before it is expired from the pool.
298      * A value of 0 means Connections never expire.
299      * @param maxStatements the maximum number of PreparedStatements that should
300      * be cached by this pool. A value of 0 means that Statement caching
301      * should be disabled.
302      *
303      * @deprecated all implementations are now both Referenceable and Serializable.
304      * use create()
305      */

306     public static DataSource JavaDoc createSerializable( String JavaDoc jdbcDriverClass,
307                          String JavaDoc jdbcUrl,
308                          String JavaDoc user,
309                          String JavaDoc password,
310                          int minPoolSize,
311                          int maxPoolSize,
312                          int acquireIncrement,
313                          int maxIdleTime,
314                          int maxStatements)
315     throws SQLException JavaDoc
316     {
317     DataSource JavaDoc nested = DriverManagerDataSourceFactory.create( jdbcDriverClass,
318                                    jdbcUrl,
319                                    user,
320                                    password );
321     return createSerializable( nested,
322                    minPoolSize,
323                    maxPoolSize,
324                    acquireIncrement,
325                    maxIdleTime,
326                    maxStatements);
327     }
328
329     /**
330      * Creates a pool-backed DataSource that implements Serializable and uses
331      * default pooling parameters.
332      *
333      * @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.
334      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
335      * @param user a username (may be null) for authentication to the RDBMS
336      * @param password a password (may be null) for authentication to the RDBMS
337      *
338      * @deprecated all implementations are now both Referenceable and Serializable.
339      * use create()
340      */

341     public static DataSource JavaDoc createSerializable( String JavaDoc jdbcDriverClass,
342                          String JavaDoc jdbcUrl,
343                          String JavaDoc user,
344                          String JavaDoc password)
345     throws SQLException JavaDoc
346     {
347     DataSource JavaDoc nested = DriverManagerDataSourceFactory.create( jdbcDriverClass,
348                                    jdbcUrl,
349                                    user,
350                                    password );
351     return createSerializable( nested );
352     }
353
354     /**
355      * Creates a pool-backed DataSource using <TT>unpooledDataSource</TT>
356      * as its source for Connections. Not necessarily suitable for JNDI binding.
357      *
358      * @param unpooledDataSource an unpooledDataSource to use as the
359      * primary source for connections.
360      * @param minPoolSize the minimum (and starting) number of Connections
361      * that should be held in the pool.
362      * @param maxPoolSize the maximum number of Connections
363      * that should be held in the pool.
364      * @param acquireIncrement the number of Connections that should be
365      * acquired at a time when the pool runs out of Connections
366      * @param maxIdleTime the maximum number of seconds a Connection should be
367      * allowed to remain idle before it is expired from the pool.
368      * A value of 0 means Connections never expire.
369      * @param maxStatements the maximum number of PreparedStatements that should
370      * be cached by this pool. A value of 0 means that Statement caching
371      * should be disabled.
372      * @param factoryLocation a codebase url where JNDI clients can find the
373      * c3p0 libraries. Use null if clients will be expected to have the
374      * libraries available locally. Used only if the JNDI service prefers
375      * References to Serialized Objects when Objects are bound.
376      */

377     public static DataSource JavaDoc create( DataSource JavaDoc unpooledDataSource,
378                      int minPoolSize,
379                      int maxPoolSize,
380                      int acquireIncrement,
381                      int maxIdleTime,
382                      int maxStatements,
383                      String JavaDoc factoryLocation) throws SQLException JavaDoc
384     {
385     return createReferenceable( unpooledDataSource,
386                     minPoolSize,
387                     maxPoolSize,
388                     acquireIncrement,
389                     maxIdleTime,
390                     maxStatements,
391                     factoryLocation );
392     }
393
394     /**
395      * Creates a pool-backed DataSource using <TT>unpooledDataSource</TT>
396      * as its source for Connections. Not necessarily suitable for JNDI binding.
397      *
398      * @param unpooledDataSource an unpooledDataSource to use as the
399      * primary source for connections.
400      * @param minPoolSize the minimum (and starting) number of Connections
401      * that should be held in the pool.
402      * @param maxPoolSize the maximum number of Connections
403      * that should be held in the pool.
404      * @param acquireIncrement the number of Connections that should be
405      * acquired at a time when the pool runs out of Connections
406      * @param maxIdleTime the maximum number of seconds a Connection should be
407      * allowed to remain idle before it is expired from the pool.
408      * A value of 0 means Connections never expire.
409      * @param maxStatements the maximum number of PreparedStatements that should
410      * be cached by this pool. A value of 0 means that Statement caching
411      * should be disabled.
412      */

413     public static DataSource JavaDoc create( DataSource JavaDoc unpooledDataSource,
414                      int minPoolSize,
415                      int maxPoolSize,
416                      int acquireIncrement,
417                      int maxIdleTime,
418                      int maxStatements ) throws SQLException JavaDoc
419     {
420     return createReferenceable( unpooledDataSource,
421                     minPoolSize,
422                     maxPoolSize,
423                     acquireIncrement,
424                     maxIdleTime,
425                     maxStatements,
426                     null );
427     }
428
429     /**
430      * Creates a pool-backed DataSource using <TT>unpooledDataSource</TT>
431      * as its source for Connections and default values for pool params.
432      *
433      * @param unpooledDataSource an unpooledDataSource to use as the
434      * primary source for connections.
435      */

436     public static DataSource JavaDoc create( DataSource JavaDoc unpooledDataSource ) throws SQLException JavaDoc
437     { return createSerializable( unpooledDataSource ); }
438
439     /**
440      * Creates a pool-backed DataSource.
441      *
442      * @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.
443      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
444      * @param user a username (may be null) for authentication to the RDBMS
445      * @param password a password (may be null) for authentication to the RDBMS
446      * @param minPoolSize the minimum (and starting) number of Connections
447      * that should be held in the pool.
448      * @param maxPoolSize the maximum number of Connections
449      * that should be held in the pool.
450      * @param acquireIncrement the number of Connections that should be
451      * acquired at a time when the pool runs out of Connections
452      * @param maxIdleTime the maximum number of seconds a Connection should be
453      * allowed to remain idle before it is expired from the pool.
454      * A value of 0 means Connections never expire.
455      * @param maxStatements the maximum number of PreparedStatements that should
456      * be cached by this pool. A value of 0 means that Statement caching
457      * should be disabled.
458      * @param factoryLocation a codebase url where JNDI clients can find the
459      * c3p0 libraries. Use null if clients will be expected to have the
460      * libraries available locally. Used only if the JNDI service prefers
461      * References to Serialized Objects when Objects are bound.
462      */

463     public static DataSource JavaDoc create( String JavaDoc jdbcDriverClass,
464                      String JavaDoc jdbcUrl,
465                      String JavaDoc user,
466                      String JavaDoc password,
467                      int minPoolSize,
468                      int maxPoolSize,
469                      int acquireIncrement,
470                      int maxIdleTime,
471                      int maxStatements,
472                      String JavaDoc factoryLocation )
473     throws SQLException JavaDoc
474     {
475     return createReferenceable( jdbcDriverClass,
476                     jdbcUrl,
477                     user,
478                     password,
479                     minPoolSize,
480                     maxPoolSize,
481                     acquireIncrement,
482                     maxIdleTime,
483                     maxStatements,
484                     factoryLocation );
485     }
486
487     /**
488      * Creates a pool-backed DataSource.
489      *
490      * @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.
491      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
492      * @param user a username (may be null) for authentication to the RDBMS
493      * @param password a password (may be null) for authentication to the RDBMS
494      * @param minPoolSize the minimum (and starting) number of Connections
495      * that should be held in the pool.
496      * @param maxPoolSize the maximum number of Connections
497      * that should be held in the pool.
498      * @param acquireIncrement the number of Connections that should be
499      * acquired at a time when the pool runs out of Connections
500      * @param maxIdleTime the maximum number of seconds a Connection should be
501      * allowed to remain idle before it is expired from the pool.
502      * A value of 0 means Connections never expire.
503      * @param maxStatements the maximum number of PreparedStatements that should
504      * be cached by this pool. A value of 0 means that Statement caching
505      * should be disabled.
506      */

507     public static DataSource JavaDoc create( String JavaDoc jdbcDriverClass,
508                      String JavaDoc jdbcUrl,
509                      String JavaDoc user,
510                      String JavaDoc password,
511                      int minPoolSize,
512                      int maxPoolSize,
513                      int acquireIncrement,
514                      int maxIdleTime,
515                      int maxStatements )
516     throws SQLException JavaDoc
517     {
518     return createReferenceable( jdbcDriverClass,
519                     jdbcUrl,
520                     user,
521                     password,
522                     minPoolSize,
523                     maxPoolSize,
524                     acquireIncrement,
525                     maxIdleTime,
526                     maxStatements,
527                     null );
528     }
529     /**
530      * Creates a pool-backed DataSource.
531      *
532      * <P>Warning: If you use this method, you must make sure a JDBC driver
533      * capable of resolving <TT>jdbcUrl</TT> has been preloaded!</P>
534      *
535      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
536      * @param user a username (may be null) for authentication to the RDBMS
537      * @param password a password (may be null) for authentication to the RDBMS
538      * @param minPoolSize the minimum (and starting) number of Connections
539      * that should be held in the pool.
540      * @param maxPoolSize the maximum number of Connections
541      * that should be held in the pool.
542      * @param acquireIncrement the number of Connections that should be
543      * acquired at a time when the pool runs out of Connections
544      * @param maxIdleTime the maximum number of seconds a Connection should be
545      * allowed to remain idle before it is expired from the pool.
546      * A value of 0 means Connections never expire.
547      * @param maxStatements the maximum number of PreparedStatements that should
548      * be cached by this pool. A value of 0 means that Statement caching
549      * should be disabled.
550      * @param factoryLocation a codebase url where JNDI clients can find the
551      * c3p0 libraries. Use null if clients will be expected to have the
552      * libraries available locally. Used only if the JNDI service prefers
553      * References to Serialized Objects when Objects are bound.
554      */

555     public static DataSource JavaDoc create( String JavaDoc jdbcUrl,
556                      String JavaDoc user,
557                      String JavaDoc password,
558                      int minPoolSize,
559                      int maxPoolSize,
560                      int acquireIncrement,
561                      int maxIdleTime,
562                      int maxStatements,
563                      String JavaDoc factoryLocation )
564     throws SQLException JavaDoc
565     {
566     return create( null,
567                jdbcUrl,
568                user,
569                password,
570                minPoolSize,
571                maxPoolSize,
572                acquireIncrement,
573                maxIdleTime,
574                maxStatements,
575                factoryLocation );
576     }
577
578     /**
579      * Creates a pool-backed DataSource.
580      *
581      * <P>Warning: If you use this method, you must make sure a JDBC driver
582      * capable of resolving <TT>jdbcUrl</TT> has been preloaded!</P>
583      *
584      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
585      * @param user a username (may be null) for authentication to the RDBMS
586      * @param password a password (may be null) for authentication to the RDBMS
587      * @param minPoolSize the minimum (and starting) number of Connections
588      * that should be held in the pool.
589      * @param maxPoolSize the maximum number of Connections
590      * that should be held in the pool.
591      * @param acquireIncrement the number of Connections that should be
592      * acquired at a time when the pool runs out of Connections
593      * @param maxIdleTime the maximum number of seconds a Connection should be
594      * allowed to remain idle before it is expired from the pool.
595      * A value of 0 means Connections never expire.
596      * @param maxStatements the maximum number of PreparedStatements that should
597      * be cached by this pool. A value of 0 means that Statement caching
598      * should be disabled.
599      */

600     public static DataSource JavaDoc create( String JavaDoc jdbcUrl,
601                      String JavaDoc user,
602                      String JavaDoc password,
603                      int minPoolSize,
604                      int maxPoolSize,
605                      int acquireIncrement,
606                      int maxIdleTime,
607                      int maxStatements )
608     throws SQLException JavaDoc
609     {
610     return create( null,
611                jdbcUrl,
612                user,
613                password,
614                minPoolSize,
615                maxPoolSize,
616                acquireIncrement,
617                maxIdleTime,
618                maxStatements,
619                null );
620     }
621
622     /**
623      * Creates a pool-backed DataSource using default values for pool parameters.
624      * Not necessarily suitable for JNDI binding.
625      *
626      * @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.
627      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
628      * @param user a username (may be null) for authentication to the RDBMS
629      * @param password a password (may be null) for authentication to the RDBMS
630      */

631     public static DataSource JavaDoc create( String JavaDoc jdbcDriverClass,
632                      String JavaDoc jdbcUrl,
633                      String JavaDoc user,
634                      String JavaDoc password) throws SQLException JavaDoc
635     {
636     return createSerializable( jdbcDriverClass,
637                    jdbcUrl,
638                    user,
639                    password );
640     }
641
642     /**
643      * Creates a pool-backed DataSource using default pool parameters.
644      *
645      *
646      * <P>Warning: If you use this method, you must make sure a JDBC driver
647      * capable of resolving <TT>jdbcUrl</TT> has been preloaded!</P>
648      *
649      * @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.
650      * @param user a username (may be null) for authentication to the RDBMS
651      * @param password a password (may be null) for authentication to the RDBMS
652      */

653     public static DataSource JavaDoc create( String JavaDoc jdbcUrl,
654                      String JavaDoc user,
655                      String JavaDoc password)
656     throws SQLException JavaDoc
657     {
658     return create( null,
659                jdbcUrl,
660                user,
661                password );
662     }
663  
664     private PoolBackedDataSourceFactory()
665     {}
666 }
667
668
669
670
671
Popular Tags