Getting at the Database
uPortal's IChannel API is very good at configurably provisioning IChannel instances with String configuration parameters, which can be specified at channel publish and/or subscribe time and are mediated by a declaratively configurable channel publishing workflow (CPDs). uPortal is much less elegant at injecting into channels the non-String resources they need.
In an IChannel, you can get at a DataSource via RDBMServices, via a JNDI lookup, or via Spring dependency injection if you go through ChannelToBeanProxy.
CSqlQuery exemplifies the DataSource from RDBMServices approach.
When in the channel lifecycle to access the db
You can retrieve your data in setRuntimeData(), store it (in an instance variable in an IChannel, in some awful channel state map in an IMultithreadedChannel, and use the stored data in renderXML(). This moves the data retrieval to earlier in the channel rendering process while still keeping it after threads have been dispatched (so other channels won't be waiting on your database connection to return.)