public class WrappingSimonDataSource extends AbstractSimonDataSource implements 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 String |
doGetRealDataSourceClassName()
Reads DataSource class name from configuration.
|
Connection |
getConnection()
Attempts to establish a connection with the data source that this
DataSource object represents. |
Connection |
getConnection(String user,
String password)
Attempts to establish a connection with the data source that this
DataSource object represents. |
DataSource |
getDataSource() |
Logger |
getParentLogger() |
boolean |
isWrapperFor(Class<?> iface) |
void |
setDataSource(DataSource ds) |
<T> T |
unwrap(Class<T> iface) |
createDataSource, getLoginTimeout, getLogWriter, getPassword, getPrefix, getProperties, getRealDataSourceClassName, getRealUrl, getUrl, getUser, setLoginTimeout, setLogWriter, setPassword, setPrefix, setProperties, setRealDataSourceClassName, setUrl, setUser
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
public WrappingSimonDataSource()
public DataSource getDataSource()
public void setDataSource(DataSource ds)
public Connection getConnection() throws SQLException
DataSource
object represents.getConnection
in interface DataSource
SQLException
- if a database access error occurspublic Connection getConnection(String user, String password) throws SQLException
DataSource
object represents.getConnection
in interface DataSource
user
- the database user on whose behalf the connection is being madepassword
- the user's passwordSQLException
- if a database access error occurspublic <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
protected String doGetRealDataSourceClassName()
AbstractSimonDataSource
doGetRealDataSourceClassName
in class AbstractSimonDataSource
public Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger
in interface CommonDataSource
SQLFeatureNotSupportedException
Copyright © 2019. All rights reserved.