Connection Manager

Penrose uses the connection manager to manage connections to the mapped data sources. Once you start Penrose, you can get the connection manager:

ConnectionManager connectionManager = penrose.getConnectionManager();

Then you can use the connection manager to open the actual connection by supplying the connection name as defined in connections.xml.

String connectionName = "ExampleDB";
Object object = connectionManager.openConnection(connectionName);

If the connection is a JDBC connection, you will get an SQL Connection object:

Connection con = (Connection)object;

If the connection is a JNDI connection, you will get a DirContext object:

DirContext ctx = (DirContext)object;