public class PooledDataSource extends AbstractDataSource
Constructor and Description |
---|
PooledDataSource()
构造,读取默认的配置文件和默认分组
|
PooledDataSource(DbConfig config)
构造
|
PooledDataSource(DbSetting setting,
String group)
构造
|
PooledDataSource(String group)
构造,读取默认的配置文件
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
protected boolean |
free(PooledConnection conn)
释放连接,连接会被返回给连接池
|
DbConfig |
getConfig() |
Connection |
getConnection()
从数据库连接池中获取数据库连接对象
|
PooledConnection |
getConnection(long wait)
获取连接对象
|
Connection |
getConnection(String username,
String password) |
static PooledDataSource |
getDataSource()
获得一个数据源,使用空分组
|
static PooledDataSource |
getDataSource(String group)
获得一个数据源
|
PooledConnection |
newConnection()
创建新连接
|
getLoginTimeout, getLogWriter, getParentLogger, isWrapperFor, setLoginTimeout, setLogWriter, unwrap
public PooledDataSource()
public PooledDataSource(String group)
group
- 分组public PooledDataSource(DbSetting setting, String group)
setting
- 数据库配置文件对象group
- 分组public PooledDataSource(DbConfig config)
config
- 数据库配置public static PooledDataSource getDataSource(String group)
group
- 数据源分组PooledDataSource
public static PooledDataSource getDataSource()
PooledDataSource
public Connection getConnection() throws SQLException
SQLException
public Connection getConnection(String username, String password) throws SQLException
SQLException
protected boolean free(PooledConnection conn)
conn
- 连接public PooledConnection newConnection() throws SQLException
SQLException
- SQL异常public DbConfig getConfig()
public PooledConnection getConnection(long wait) throws SQLException
wait
- 当池中无连接等待的毫秒数SQLException
- SQL异常public void close()
Copyright © 2024. All rights reserved.