While discussing about ServletContextListener, HFSJSP 2e says that it is used for initializing a DataSource. Is this a good approach? I've seen the DataSource objects are handled by the container itself. What is the best way?
My take on this is that it's a good way to do it because the datasource lookup only happens once. I've seen other code where the lookup happens over and over again which is a waste of resources. I've tried different ways of doing it and based on feedback that I received here, this is the context listener that I now use.
This is the DataSourceHolder class:
Suggestions for improving this are welcome.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson