|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.cid.distribution.base.DistributionComponentBase org.cid.distribution.plugins.db.ConnectionComponent
public class ConnectionComponent
The ConnectionComponent holds a connection to a database manager. This is used by other plugins in the db package to work with relational databases.
The ConnectionComponent uses the JDBC API to access different database manager systems. To access each particular database system, JDBC uses a library called JDBC driver. Distribution does not include JDBC drivers in the package so you will have to get them yourself.
To install the JDBC driver just drop it in distribution the lib, or alternatively place it in any directory in your Java classpath directory.
Each JDBC driver uses a different syntax to define a database connection. Check your JDBC driver docs to know how to express your database connection URL.
Example configuration:
com.mysql.jdbc.Driver jdbc:mysql://host:3306/database?autoReconnect=true username password ]]>
This element stablishes a single connection to a data source. The connection cannot be reused. If you need more than one connection, duplicate the component ore use a ConnectionPoolComponent.
Constructor Summary | |
---|---|
ConnectionComponent()
Class constructor. |
Method Summary | |
---|---|
static void |
addRules(org.apache.commons.digester.Digester d,
java.lang.String patternPrefix)
Configures additional rules for the commons-digester library. |
void |
destroy()
When destroyed, this component logs information about the process. |
java.sql.Connection |
getConnection()
Returns the database connection. |
java.lang.String |
getDriverClass()
|
java.lang.String |
getPassword()
|
java.lang.String |
getUrl()
|
java.lang.String |
getUsername()
|
void |
init()
Initializes the ConnectionComponent. |
void |
setDriverClass(java.lang.String driverClass)
|
void |
setPassword(java.lang.String password)
|
void |
setUrl(java.lang.String url)
|
void |
setUsername(java.lang.String username)
|
Methods inherited from class org.cid.distribution.base.DistributionComponentBase |
---|
getId, setDistributionContext, setId |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionComponent()
Method Detail |
---|
public static void addRules(org.apache.commons.digester.Digester d, java.lang.String patternPrefix)
public void init() throws DistributionProcessingException, DistributionConfigurationException
init
in interface DistributionComponent
init
in class DistributionComponentBase
DistributionProcessingException
DistributionConfigurationException
DistributionComponentBase.init()
public void destroy() throws DistributionProcessingException, DistributionConfigurationException
destroy
in interface DistributionComponent
destroy
in class DistributionComponentBase
DistributionProcessingException
DistributionConfigurationException
public java.sql.Connection getConnection() throws DistributionProcessingException
getConnection
in interface ConnectionProvider
DistributionProcessingException
public java.lang.String getDriverClass()
public void setDriverClass(java.lang.String driverClass)
driverClass
- The driverClass to set.public java.lang.String getPassword()
public void setPassword(java.lang.String password)
password
- The password to set.public java.lang.String getUrl()
public void setUrl(java.lang.String url)
url
- The url to set.public java.lang.String getUsername()
public void setUsername(java.lang.String username)
username
- The username to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |