Dashboard > Penrose 1.0 > ... > Embedding Penrose > Connection API
Connection API
Added by Endi S. Dewata, last edited by Endi S. Dewata on Feb 28, 2006
Labels: 
(None)


Creating Connection Configuration

To create a connection configuration:

String name = "Example";
String adapterName = "JDBC";
ConnectionConfig connectionConfig = new ConnectionConfig(name, adapterName);

Adapter Name

You can change the adapter name this way:

String adapterName = "JNDI";
connectionConfig.setAdapterName(adapterName);

Parameters

To get all parameter names:

Collection parameterNames = connectionConfig.getParameterNames();
for (Iterator i=parameterNames.iterator(); i.hasNext(); ) {
    String parameterName = (String)i.next();
    ...
}

To get a parameter value:

String parameterName = "url";
String parameterValue = connectionConfig.getParameter(parameterName);

To set a parameter value:

String parameterName = "url";
String parameterValue = "jdbc:mysql://localhost/example:3306?autoReconnect=true";
connectionConfig.setParameter(parameterName, parameterValue);

See Connections for the complete list of valid parameters.

References

Site running on a free Atlassian Confluence Open Source Project License granted to Safehaus. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators