⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 poolbackeddatasourcefactory.java

📁 c3p0数据库连接池实现源码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
	DataSource nested = DriverManagerDataSourceFactory.create( jdbcDriverClass, 								   jdbcUrl, 								   user, 								   password );	return createSerializable( nested );    }    /**     *  Creates a pool-backed DataSource using <TT>unpooledDataSource</TT>     *  as its source for Connections. Not necessarily suitable for JNDI binding.     *     *  @param unpooledDataSource an unpooledDataSource to use as the     *         primary source for connections.     *  @param minPoolSize the minimum (and starting) number of Connections     *         that should be held in the pool.     *  @param maxPoolSize the maximum number of Connections     *         that should be held in the pool.     *  @param acquireIncrement the number of Connections that should be     *         acquired at a time when the pool runs out of Connections     *  @param maxIdleTime the maximum number of seconds a Connection should be     *         allowed to remain idle before it is expired from the pool.     *         A value of 0 means Connections never expire.     *  @param maxStatements the maximum number of PreparedStatements that should      *         be cached by this pool. A value of 0 means that Statement caching     *         should be disabled.     *  @param factoryLocation a codebase url where JNDI clients can find the       *         c3p0 libraries. Use null if clients will be expected to have the     *         libraries available locally. Used only if the JNDI service prefers     *         References to Serialized Objects when Objects are bound.     */    public static DataSource create( DataSource unpooledDataSource,				     int minPoolSize,				     int maxPoolSize,				     int acquireIncrement,				     int maxIdleTime,				     int maxStatements,				     String factoryLocation) throws SQLException    {	return createReferenceable( unpooledDataSource,				    minPoolSize,				    maxPoolSize,				    acquireIncrement,				    maxIdleTime,				    maxStatements,  				    factoryLocation );    }    /**     *  Creates a pool-backed DataSource using <TT>unpooledDataSource</TT>     *  as its source for Connections. Not necessarily suitable for JNDI binding.     *     *  @param unpooledDataSource an unpooledDataSource to use as the     *         primary source for connections.     *  @param minPoolSize the minimum (and starting) number of Connections     *         that should be held in the pool.     *  @param maxPoolSize the maximum number of Connections     *         that should be held in the pool.     *  @param acquireIncrement the number of Connections that should be     *         acquired at a time when the pool runs out of Connections     *  @param maxIdleTime the maximum number of seconds a Connection should be     *         allowed to remain idle before it is expired from the pool.     *         A value of 0 means Connections never expire.     *  @param maxStatements the maximum number of PreparedStatements that should      *         be cached by this pool. A value of 0 means that Statement caching     *         should be disabled.     */    public static DataSource create( DataSource unpooledDataSource,				     int minPoolSize,				     int maxPoolSize,				     int acquireIncrement,				     int maxIdleTime,				     int maxStatements ) throws SQLException    {	return createReferenceable( unpooledDataSource,				    minPoolSize,				    maxPoolSize,				    acquireIncrement,				    maxIdleTime,				    maxStatements,  				    null );    }    /**     *  Creates a pool-backed DataSource using <TT>unpooledDataSource</TT>     *  as its source for Connections and default values for pool params.      *     *  @param unpooledDataSource an unpooledDataSource to use as the     *         primary source for connections.     */    public static DataSource create( DataSource unpooledDataSource ) throws SQLException    { return createSerializable( unpooledDataSource ); }    /**     *  Creates a pool-backed DataSource.     *     *  @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.     *  @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.     *  @param user a username (may be null) for authentication to the RDBMS     *  @param password a password (may be null) for authentication to the RDBMS     *  @param minPoolSize the minimum (and starting) number of Connections     *         that should be held in the pool.     *  @param maxPoolSize the maximum number of Connections     *         that should be held in the pool.     *  @param acquireIncrement the number of Connections that should be     *         acquired at a time when the pool runs out of Connections     *  @param maxIdleTime the maximum number of seconds a Connection should be     *         allowed to remain idle before it is expired from the pool.     *         A value of 0 means Connections never expire.     *  @param maxStatements the maximum number of PreparedStatements that should      *         be cached by this pool. A value of 0 means that Statement caching     *         should be disabled.     *  @param factoryLocation a codebase url where JNDI clients can find the       *         c3p0 libraries. Use null if clients will be expected to have the     *         libraries available locally. Used only if the JNDI service prefers     *         References to Serialized Objects when Objects are bound.     */    public static DataSource create( String jdbcDriverClass,				     String jdbcUrl,				     String user,				     String password,				     int minPoolSize,				     int maxPoolSize,				     int acquireIncrement,				     int maxIdleTime,				     int maxStatements,				     String factoryLocation ) 	throws SQLException    {	return createReferenceable( jdbcDriverClass,				    jdbcUrl,				    user,				    password,				    minPoolSize,				    maxPoolSize,				    acquireIncrement,				    maxIdleTime,				    maxStatements,				    factoryLocation );    }    /**     *  Creates a pool-backed DataSource.     *     *  @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.     *  @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.     *  @param user a username (may be null) for authentication to the RDBMS     *  @param password a password (may be null) for authentication to the RDBMS     *  @param minPoolSize the minimum (and starting) number of Connections     *         that should be held in the pool.     *  @param maxPoolSize the maximum number of Connections     *         that should be held in the pool.     *  @param acquireIncrement the number of Connections that should be     *         acquired at a time when the pool runs out of Connections     *  @param maxIdleTime the maximum number of seconds a Connection should be     *         allowed to remain idle before it is expired from the pool.     *         A value of 0 means Connections never expire.     *  @param maxStatements the maximum number of PreparedStatements that should      *         be cached by this pool. A value of 0 means that Statement caching     *         should be disabled.     */    public static DataSource create( String jdbcDriverClass,				     String jdbcUrl,				     String user,				     String password,				     int minPoolSize,				     int maxPoolSize,				     int acquireIncrement,				     int maxIdleTime,				     int maxStatements )	throws SQLException    {	return createReferenceable( jdbcDriverClass,				    jdbcUrl,				    user,				    password,				    minPoolSize,				    maxPoolSize,				    acquireIncrement,				    maxIdleTime,				    maxStatements,				    null );    }    /**     *  Creates a pool-backed DataSource.     *     *  <P>Warning: If you use this method, you must make sure a JDBC driver     *  capable of resolving <TT>jdbcUrl</TT> has been preloaded!</P>     *     *  @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.     *  @param user a username (may be null) for authentication to the RDBMS     *  @param password a password (may be null) for authentication to the RDBMS     *  @param minPoolSize the minimum (and starting) number of Connections     *         that should be held in the pool.     *  @param maxPoolSize the maximum number of Connections     *         that should be held in the pool.     *  @param acquireIncrement the number of Connections that should be     *         acquired at a time when the pool runs out of Connections     *  @param maxIdleTime the maximum number of seconds a Connection should be     *         allowed to remain idle before it is expired from the pool.     *         A value of 0 means Connections never expire.     *  @param maxStatements the maximum number of PreparedStatements that should      *         be cached by this pool. A value of 0 means that Statement caching     *         should be disabled.     *  @param factoryLocation a codebase url where JNDI clients can find the       *         c3p0 libraries. Use null if clients will be expected to have the     *         libraries available locally. Used only if the JNDI service prefers     *         References to Serialized Objects when Objects are bound.     */    public static DataSource create( String jdbcUrl,				     String user,				     String password,				     int minPoolSize,				     int maxPoolSize,				     int acquireIncrement,				     int maxIdleTime,				     int maxStatements,				     String factoryLocation ) 	throws SQLException    {	return create( null,		       jdbcUrl,		       user,		       password,		       minPoolSize,		       maxPoolSize,		       acquireIncrement,		       maxIdleTime,		       maxStatements,		       factoryLocation );    }    /**     *  Creates a pool-backed DataSource.     *     *  <P>Warning: If you use this method, you must make sure a JDBC driver     *  capable of resolving <TT>jdbcUrl</TT> has been preloaded!</P>     *     *  @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.     *  @param user a username (may be null) for authentication to the RDBMS     *  @param password a password (may be null) for authentication to the RDBMS     *  @param minPoolSize the minimum (and starting) number of Connections     *         that should be held in the pool.     *  @param maxPoolSize the maximum number of Connections     *         that should be held in the pool.     *  @param acquireIncrement the number of Connections that should be     *         acquired at a time when the pool runs out of Connections     *  @param maxIdleTime the maximum number of seconds a Connection should be     *         allowed to remain idle before it is expired from the pool.     *         A value of 0 means Connections never expire.     *  @param maxStatements the maximum number of PreparedStatements that should      *         be cached by this pool. A value of 0 means that Statement caching     *         should be disabled.     */    public static DataSource create( String jdbcUrl,				     String user,				     String password,				     int minPoolSize,				     int maxPoolSize,				     int acquireIncrement,				     int maxIdleTime,				     int maxStatements )	throws SQLException    {	return create( null,		       jdbcUrl,		       user,		       password,		       minPoolSize,		       maxPoolSize,		       acquireIncrement,		       maxIdleTime,		       maxStatements,		       null );    }    /**     *  Creates a pool-backed DataSource using default values for pool parameters.     *  Not necessarily suitable for JNDI binding.     *     *  @param jdbcDriverClass a jdbc driver class that can resolve <TT>jdbcUrl</TT>.     *  @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.     *  @param user a username (may be null) for authentication to the RDBMS     *  @param password a password (may be null) for authentication to the RDBMS     */    public static DataSource create( String jdbcDriverClass,				     String jdbcUrl,				     String user,				     String password) throws SQLException    {	return createSerializable( jdbcDriverClass,				   jdbcUrl,				   user,				   password );    }    /**     *  Creates a pool-backed DataSource using default pool parameters.     *     *     *  <P>Warning: If you use this method, you must make sure a JDBC driver     *  capable of resolving <TT>jdbcUrl</TT> has been preloaded!</P>     *     *  @param jdbcUrl the jdbcUrl of the RDBMS that Connections should be made to.     *  @param user a username (may be null) for authentication to the RDBMS     *  @param password a password (may be null) for authentication to the RDBMS     */    public static DataSource create( String jdbcUrl,				     String user,				     String password) 	throws SQLException    {	return create( null, 		       jdbcUrl,		       user,		       password );    }     private PoolBackedDataSourceFactory()    {}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -