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.jdbcx4
getConnection
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, setUser
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
public SimonDataSource()
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.