| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Objectcom.mchange.v2.c3p0.DataSourcespublic final class DataSourcesextends java.lang.ObjectPoolConfig
for details.
Method Summary | |
static void |
|
static void |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
static DataSource |
|
public static void destroy(DataSource pooledDataSource)
throws SQLExceptionImmediately releases resources (Threads and database Connections) that are held by a C3P0 DataSource. Only DataSources created by the poolingDataSource() method hold any non-memory resources. Calling this method on unpooled DataSources is effectively a no-op. You can safely presume that destroying a pooled DataSource that is wrapped around another DataSource created by this library destroys both the outer and the wrapped DataSource. There is no reason to hold a reference to a nested DataSource in order to explicitly destroy it.
- See Also:
PoolConfig
public static void forceDestroy(DataSource pooledDataSource)
throws SQLExceptionDeprecated. forceDestroy() is no longer meaningful, as a set of pools is now directly associated with a DataSource, and not potentially shared. (This simplification was made possible by canonicalization of JNDI-looked-up DataSources within a virtual machine.) Just use DataSources.destroy().
- See Also:
destroy(DataSource)
public static DataSource pooledDataSource(DataSource unpooledDataSource)
throws SQLExceptionCreates a pooled version of an unpooled DataSource using default configuration information. NOTE: By default, statement pooling is turned off, because for simple databases that do not pre-parse and optimize PreparedStatements, statement caching is a net performance loss. But if your database does optimize PreparedStatements you'll want to turn StatementCaching on viapooledDataSource(javax.sql.DataSource, int).
- Returns:
- a DataSource that can be cast to a
PooledDataSourceif you are interested in pool statistics
public static DataSource pooledDataSource(DataSource unpooledDataSource,
Map overrideProps)
throws SQLExceptionpublic static DataSource pooledDataSource(DataSource unpooledDataSource,
Properties props)
throws SQLExceptionCreates a pooled version of an unpooled DataSource using configuration information supplied explicitly by a Java Properties object.
- Returns:
- a DataSource that can be cast to a
PooledDataSourceif you are interested in pool statistics
- See Also:
PoolConfig
public static DataSource pooledDataSource(DataSource unpooledDataSource,
String configName)
throws SQLExceptionpublic static DataSource pooledDataSource(DataSource unpooledDataSource,
String configName,
Map overrideProps)
throws SQLExceptionpublic static DataSource pooledDataSource(DataSource unpooledDataSource,
PoolConfig pcfg)
throws SQLExceptionDeprecated. if you want to set properties programmatically, please construct a ComboPooledDataSource and set its properties rather than using PoolConfig
Creates a pooled version of an unpooled DataSource using configuration information supplied explicitly by aPoolConfig.
- Returns:
- a DataSource that can be cast to a
PooledDataSourceif you are interested in pool statistics
public static DataSource pooledDataSource(DataSource unpooledDataSource,
int statement_cache_size)
throws SQLExceptionCreates a pooled version of an unpooled DataSource using default configuration information and the specified startement cache size. Use a value greater than zero to turn statement caching on.
- Returns:
- a DataSource that can be cast to a
PooledDataSourceif you are interested in pool statistics
public static DataSource unpooledDataSource()
throws SQLExceptionDefines an unpooled DataSource all of whose paramateres (especially jdbcUrl) should be set in config files.
public static DataSource unpooledDataSource(String jdbcUrl)
throws SQLExceptionpublic static DataSource unpooledDataSource(String jdbcUrl,
Properties driverProps)
throws SQLExceptionDefines an unpooled DataSource on the specified JDBC URL.
- Parameters:
driverProps- the usual DriverManager properties for your JDBC driver (e.g. "user" and "password" for all drivers that support authentication)
- See Also:
java.sql.DriverManager
public static DataSource unpooledDataSource(String jdbcUrl,
String user,
String password)
throws SQLExceptionDefines an unpooled DataSource on the specified JDBC URL, authenticating with a username and password.