public class WrappingSimonDataSource extends AbstractSimonDataSource implements javax.sql.DataSource
<bean id="dataSource" class="org.javasimon.jdbcx.WrappingSimonDataSource">
<property name="dataSource" ref="pooledDataSource"/>
<property name="prefix" value="sky.batchpricer.skydb"/>
</bean>
<bean id="pooledDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="my.driver.class.Driver"/>
<property name="url" value="${mydb.url}"/>
<property name="initialSize" value="0"/>
<property name="maxActive" value="5"/>
<property name="maxIdle" value="2"/>
<property name="validationQuery" value="SELECT 1"/>
</bean>
configuration, logWriter
Constructor and Description |
---|
WrappingSimonDataSource() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
doGetRealDataSourceClassName()
Reads DataSource class name from configuration.
|
java.sql.Connection |
getConnection()
Attempts to establish a connection with the data source that this
DataSource object represents. |
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password)
Attempts to establish a connection with the data source that this
DataSource object represents. |
javax.sql.DataSource |
getDataSource() |
java.util.logging.Logger |
getParentLogger() |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setDataSource(javax.sql.DataSource ds) |
<T> T |
unwrap(java.lang.Class<T> iface) |
createDataSource, getLoginTimeout, getLogWriter, getPassword, getPrefix, getProperties, getRealDataSourceClassName, getRealUrl, getUrl, getUser, setLoginTimeout, setLogWriter, setPassword, setPrefix, setProperties, setRealDataSourceClassName, setUrl, setUser
public WrappingSimonDataSource()
public javax.sql.DataSource getDataSource()
public void setDataSource(javax.sql.DataSource ds)
public java.sql.Connection getConnection() throws java.sql.SQLException
DataSource
object represents.getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- if a database access error occurspublic java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
DataSource
object represents.getConnection
in interface javax.sql.DataSource
user
- the database user on whose behalf the connection is being madepassword
- the user's passwordjava.sql.SQLException
- if a database access error occurspublic <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
protected java.lang.String doGetRealDataSourceClassName()
AbstractSimonDataSource
doGetRealDataSourceClassName
in class AbstractSimonDataSource
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
getParentLogger
in interface javax.sql.CommonDataSource
java.sql.SQLFeatureNotSupportedException
Copyright © 2018. All Rights Reserved.