Simply put the appropriate classes, such as:
- the JDBC driver classes for your database
into the appropriate ServletExec classpath and create an instance of the DataSource object and then use it.
If you wish, you may place your DataSource instance into a JNDI context so that your other code running inside of ServletExec can look it up and use it.
Beginning with version 4.0 of ServletExec, the ability to Manage your DataSources from the Main ServletExec Admin UI was added. With that version of ServletExec (and all higher versions), ServletExec provides an initial JNDI context into which your configured datasources will be automatically added.
Your code could then lookup the DataSource using the following syntax:
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup( "jdbc/<data source name>" );