posted 19 years ago
we have some stateless session beans that use a DataSource to do some db stuff. there's one static class DatabaseManager, which is used by all the beans and basically "manages" the use of a data source (provides convenience methods i guess). the beans initialize this database manager by getting some strings from their env-entries, DataSourceURL, DataSourceJNDIName, InitialContextFactory. the DatabaseManager then gets the datasource using the provided information.
this completely sidesteps the use of a resource-ref by the beans. and i see quite a few issues regarding this practice. i'd like to hear what some of the other ranchers think.
the bean's env-entry is hardwired to a specific url/connection factory for getting to a datasource. the dd needs to be reconfigured if the bean is going to be put into a container that is on a different port.
i'm also concerned that our container will give out a datasource when doing a remote lookup like this. maybe it's configurable to not allow this activity, but it seems to be that any client application could do a lookup on the server and get a datasource and effectively have open access to the database? i haven't tried yet to bring up a runnign server, and try with a separate client application to get a datasource from the server the same way the beans do, but that's on my list.
if anyone has any comments/thoughts on this it would certainly be most appreciated.