|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object raccoon.core.types.AbsComponent raccoon.core.types.AbsLoadable raccoon.core.types.AbsConfigurableLoadable raccoon.core.jdbc.ConnectionDriver
public class ConnectionDriver
A simple JDBC Driver to provide pooling capabilities to Raccoon in a none container context.
Field Summary |
---|
Fields inherited from class raccoon.core.types.AbsConfigurableLoadable |
---|
mConfigurableManager |
Fields inherited from class raccoon.core.types.AbsLoadable |
---|
mIsLoaded |
Fields inherited from class raccoon.core.types.AbsComponent |
---|
mIsInError |
Fields inherited from interface raccoon.api.utils.IConnectionDriver |
---|
PTY_CONNECTION_DRIVER, PTY_CONNECTION_URL, PTY_DATABASE_DRIVER, PTY_USER_NAME, PTY_USER_PWD, URL_PREFIX |
Constructor Summary | |
---|---|
ConnectionDriver()
|
|
ConnectionDriver(java.lang.String pDriver,
java.lang.String pUrl,
java.lang.String pUser,
java.lang.String pPassword)
|
Method Summary | |
---|---|
boolean |
acceptsURL(java.lang.String url)
Retrieves whether the driver thinks that it can open a connection to the given URL. |
void |
configureParameters()
Configures the various parameters for this component. |
java.sql.Connection |
connect(java.lang.String pUrl,
java.util.Properties pInfo)
Attempts to make a database connection to the given URL. |
java.lang.String |
getConnectionUrl()
The URL connnection string to the database. |
java.lang.String |
getDatabaseDriver()
The name of the database driver. |
int |
getMajorVersion()
Retrieves the driver's major version number. |
int |
getMinorVersion()
Gets the driver's minor version number. |
java.sql.DriverPropertyInfo[] |
getPropertyInfo(java.lang.String url,
java.util.Properties info)
Gets information about the possible properties for this driver. |
java.lang.String |
getUrl()
The database URL to use to retrieve a connection from this pool. |
java.lang.String |
getUserName()
The name of the user for database connection. |
java.lang.String |
getUserPwd()
The password associated to the provided user. |
boolean |
jdbcCompliant()
Reports whether this driver is a genuine JDBC CompliantTM driver. |
void |
load()
Loads or initializes the component. |
void |
setConnectionUrl(java.lang.String pConnectionUrl)
Defines the URL connection to the database. |
void |
setDatabaseDriver(java.lang.String pDatabaseDriver)
Defines the database driver to use. |
void |
setUserName(java.lang.String pUserName)
Defines the user name to use for the connection. |
void |
setUserPwd(java.lang.String pUserPwd)
Defines the password of the provided user. |
Methods inherited from class raccoon.core.types.AbsConfigurableLoadable |
---|
isStable, setConfigurableManager, setLogger |
Methods inherited from class raccoon.core.types.AbsLoadable |
---|
getLog, isInError, isInitialised, isRunning, unload |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionDriver()
public ConnectionDriver(java.lang.String pDriver, java.lang.String pUrl, java.lang.String pUser, java.lang.String pPassword) throws java.sql.SQLException, java.lang.ClassNotFoundException
java.sql.SQLException
java.lang.ClassNotFoundException
Method Detail |
---|
public java.lang.String getUrl()
getUrl
in interface IConnectionDriver
public void configureParameters()
IConfigurableManager
provided during the invocation of AbsConfigurableLoadable.setConfigurableManager(raccoon.api.types.IConfigurableManager)
.
configureParameters
in interface IConfigurable
configureParameters
in class AbsConfigurableLoadable
public java.lang.String getDatabaseDriver()
public void setDatabaseDriver(java.lang.String pDatabaseDriver) throws ResourceNotFoundException
pDatabaseDriver
- the name of the database driver.
ResourceNotFoundException
- in case of an internal error.public java.lang.String getConnectionUrl()
public void setConnectionUrl(java.lang.String pConnectionUrl) throws ResourceNotFoundException
pConnectionUrl
- the url connection string.
ResourceNotFoundException
public java.lang.String getUserName()
public void setUserName(java.lang.String pUserName) throws ResourceNotFoundException
pUserName
- the user name.
ResourceNotFoundException
public java.lang.String getUserPwd()
#getUserName()}
public void setUserPwd(java.lang.String pUserPwd)
pUserPwd
- the password of the user for the database.public void load() throws java.lang.IllegalStateException, LoadableException
load
in interface ILoadable
load
in class AbsConfigurableLoadable
LoadableException
- if the component couldn't load itself.
java.lang.IllegalStateException
- if the component isn't in a state to load itself. for example it is already loaded.public java.sql.Connection connect(java.lang.String pUrl, java.util.Properties pInfo) throws java.sql.SQLException
The driver should throw an SQLException
if it is the right driver to connect to the given URL but
has trouble connecting to the database.
The java.util.Properties
argument can be used to pass arbitrary string tag/value pairs as
connection arguments. Normally at least "user" and "password" properties should be included in the
Properties
object.
connect
in interface java.sql.Driver
pUrl
- the URL of the database to which to connectpInfo
- a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and
"password" property should be included.
Connection
object that represents a connection to the URL
java.sql.SQLException
- if a database access error occurspublic boolean acceptsURL(java.lang.String url) throws java.sql.SQLException
true
if they understand the subprotocol specified in the URL and false
if they do not.
acceptsURL
in interface java.sql.Driver
url
- the URL of the database
true
if this driver understands the given URL; false
otherwise
java.sql.SQLException
- if a database access error occurspublic java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
The getPropertyInfo
method is
intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get
enough information to connect to a database. Note that depending on the values the human has supplied so far,
additional values may become necessary, so it may be necessary to iterate though several calls to the
getPropertyInfo
method.
getPropertyInfo
in interface java.sql.Driver
url
- the URL of the database to which to connectinfo
- a proposed list of tag/value pairs that will be sent on connect open
DriverPropertyInfo
objects describing possible properties. This array may be an
empty array if no properties are required.
java.sql.SQLException
- if a database access error occurspublic int getMajorVersion()
getMajorVersion
in interface java.sql.Driver
public int getMinorVersion()
getMinorVersion
in interface java.sql.Driver
public boolean jdbcCompliant()
true
here if it passes the JDBC compliance tests; otherwise it is required to return
false
. JDBC compliance requires full support for the JDBC API and full support for SQL 92 Entry Level. It is expected that JDBC compliant drivers will be available for all the major commercial databases.
This method is not intended to encourage the development of non-JDBC compliant drivers, but is a recognition of the fact that some vendors are interested in using the JDBC API and framework for lightweight databases that do not support full database functionality, or for special databases such as document information retrieval where a SQL implementation may not be feasible.
jdbcCompliant
in interface java.sql.Driver
true
if this driver is JDBC Compliant; false
otherwise
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |