public final class SimonDataSource extends AbstractSimonDataSource implements DataSource
Connection
object.
To use SimonDataSource, MUST properties are:
realDataSourceClassName - full qualified classname of real Datasource
implementationurl - JDBC connection URL (no special Simon added tags are needed)user - DB user namepassword - DB user nameprefix - Simon prefix (default: org.javasimon.jdbcx4getConnection methods
just invokes real DataSource object methods and wraps obtained
Connection with SimonConnection object.
Real DataSource is obtained in method datasource(). It tries
to instantiate real datasource object by property realDataSourceClassName
(setters and getters for properties are in AbstractSimonDataSource) and then sets
basic properties (url, user, password).configuration, logWriter| Constructor and Description |
|---|
SimonDataSource() |
| 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. |
Logger |
getParentLogger() |
boolean |
isWrapperFor(Class<?> iface) |
<T> T |
unwrap(Class<T> iface) |
createDataSource, getLoginTimeout, getLogWriter, getPassword, getPrefix, getProperties, getRealDataSourceClassName, getRealUrl, getUrl, getUser, setLoginTimeout, setLogWriter, setPassword, setPrefix, setProperties, setRealDataSourceClassName, setUrl, setUserclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLoginTimeout, getLogWriter, setLoginTimeout, setLogWriterpublic SimonDataSource()
public Connection getConnection() throws SQLException
DataSource object represents.getConnection in interface DataSourceSQLException - if a database access error occurspublic Connection getConnection(String user, String password) throws SQLException
DataSource object represents.getConnection in interface DataSourceuser - 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 WrapperSQLExceptionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionprotected String doGetRealDataSourceClassName()
AbstractSimonDataSourcedoGetRealDataSourceClassName in class AbstractSimonDataSourcepublic Logger getParentLogger() throws SQLFeatureNotSupportedException
getParentLogger in interface CommonDataSourceSQLFeatureNotSupportedExceptionCopyright © 2019. All rights reserved.