public final class SimonDataSource extends AbstractSimonDataSource implements javax.sql.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 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. |
java.util.logging.Logger |
getParentLogger() |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
<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 SimonDataSource()
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.