org.javasimon.jdbcx
Class SimonDataSource
java.lang.Object
org.javasimon.jdbcx.AbstractSimonDataSource
org.javasimon.jdbcx.SimonDataSource
- All Implemented Interfaces:
- Wrapper, CommonDataSource, DataSource
public final class SimonDataSource
- extends AbstractSimonDataSource
- implements DataSource
Wrapper class for real DataSource implementation, produces standard Connection
object.
To use SimonDataSource, MUST properties are:
realDataSourceClassName - full qualified classname of real Datasource
implementation
url - JDBC connection URL (no special Simon added tags are needed)
user - DB user name
password - DB user name
MAY properties are:
perfix - Simon prefix (default: org.javasimon.jdbcx
As mentioned in package description all 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).
- Since:
- 1.0
- Version:
- $Revision: 304 $ $Date: 2011-04-08 10:39:02 +0200 (Fri, 08 Apr 2011) $
- Author:
- Radovan Sninsky
| Methods inherited from class org.javasimon.jdbcx.AbstractSimonDataSource |
getLoginTimeout, getLogWriter, getPassword, getPrefix, getRealDataSourceClassName, getUrl, getUser, setLoginTimeout, setLogWriter, setPassword, setPrefix, setRealDataSourceClassName, setUrl, setUser |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ds
private DataSource ds
SimonDataSource
public SimonDataSource()
datasource
private DataSource datasource()
throws SQLException
- Throws:
SQLException
getConnection
public Connection getConnection()
throws SQLException
Attempts to establish a connection with the data source that
this DataSource object represents.
- Specified by:
getConnection in interface DataSource
- Returns:
- a connection to the data source
- Throws:
SQLException - if a database access error occurs
getConnection
public Connection getConnection(String user,
String password)
throws SQLException
Attempts to establish a connection with the data source that
this DataSource object represents.
- Specified by:
getConnection in interface DataSource
- Parameters:
user - the database user on whose behalf the connection is being madepassword - the user's password
- Returns:
- a connection to the data source
- Throws:
SQLException - if a database access error occurs
Copyright © 2011. All Rights Reserved.