public class DefaultDataSource
extends java.lang.Object
implements javax.sql.DataSource
1.Create new datasource from jdbc config DriverDataSource dds = new DriverDataSource(new DriverProperties()); 2.Create new datasource from context of server just like Tomcat锟斤拷 Context ctx = new InitialContext(); DataSource ds = ctx.lookup("jdbc/db"); 3.Create new datasource from Persistence frame ConnectionPoolServer.initPool(); DataSource ds = ConnectionPoolContext.getDataSource("mysql");
限定符和类型 | 字段和说明 |
---|---|
private java.sql.Connection |
conn |
private DriverProperties |
driver |
private static java.lang.String |
KEY_ENTER |
private int |
maxLoginTime |
private static java.lang.String |
REPORTER |
private java.io.PrintWriter |
writer |
构造器和说明 |
---|
DefaultDataSource(DriverProperties driver)
Construction
|
限定符和类型 | 方法和说明 |
---|---|
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password) |
DriverProperties |
getDriverProperties()
Get driver configuration
|
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
java.util.logging.Logger |
getParentLogger() |
private void |
initConnection()
Initialize Connection
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(java.io.PrintWriter out) |
private void |
throwExcpetion(java.lang.String message,
java.lang.Throwable cause) |
<T> T |
unwrap(java.lang.Class<T> iface) |
private DriverProperties driver
private java.sql.Connection conn
private static final java.lang.String REPORTER
private static final java.lang.String KEY_ENTER
private java.io.PrintWriter writer
private int maxLoginTime
public DefaultDataSource(DriverProperties driver) throws OperationsException
driver
- jdbc config objectOperationsException
private final void initConnection() throws OperationsException
public java.sql.Connection getConnection()
getConnection
在接口中 javax.sql.DataSource
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
getConnection
在接口中 javax.sql.DataSource
private void throwExcpetion(java.lang.String message, java.lang.Throwable cause) throws OperationsException
message
- Stringcause
- ThrowableOperationsException
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
getLogWriter
在接口中 javax.sql.CommonDataSource
java.sql.SQLException
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
setLogWriter
在接口中 javax.sql.CommonDataSource
java.sql.SQLException
public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
在接口中 javax.sql.CommonDataSource
java.sql.SQLException
public void setLoginTimeout(int seconds) throws java.sql.SQLException
setLoginTimeout
在接口中 javax.sql.CommonDataSource
java.sql.SQLException
public DriverProperties getDriverProperties()
com.nonesole.persistence.connectionpool.IDriverDataSource#getDriverProperties()
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
getParentLogger
在接口中 javax.sql.CommonDataSource
java.sql.SQLFeatureNotSupportedException
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
在接口中 java.sql.Wrapper
java.sql.SQLException
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
在接口中 java.sql.Wrapper
java.sql.SQLException