DataSource Connector Usage
A DataSourceConnector is used as a factory for creating connections to a DBMS. For more information regarding connectors and how they are used within the context of alakai, please see the the user guide.
To use a DataSourceConnector within your code, you retrieve it and cast it to a javax DataSource as demonstrated below. Note that DataSourceConnector configuration is provider specific. Please refer to each specific provider for configuration examples.
...
// note that once directory server feature has been implemented, connectors
// will be automatically bound to a name context and can be retrieved via jndi
Container container = SystemContext.getContext().getSystem().getContainer();
Connector connector = container.getConnector("myDataSource");
javax.sql.DataSource dataSource = (javax.sql.DataSource)connector;
java.sql.Connection connection = dataSource.getConnection();
...