I have a MySQL database with many databases, each named for a specific customer.
A webapp is deployed per customer. The name of the webapp determines the underlying database name. When the webapp starts up, I have a modified Spring PropertyPlaceholderConfigurer to grab the ServletContext if it can and determine the name. I then dereference this in my datasource setup. Works beautifully. The exact same code can be deployed to all customers and they find their database without issue (also a DNS name to locate the MySQL host).
I'd like to switch to GlassFish or JBoss AS 6 and still do the same thing with straight JEE6 API/annotations.
Is there a way to do this? I'm not worried about security -- the datasets are large enough to justify their own machines and webapps and since the database model is tied to the code, they need to be kept in sync. Since not every customer needs to have the latest code for the task at hand, they revision at different rates.
I like the convenience of JEE6 consolidating a lot what Spring used to have and then some but I hate having to deal with application servers and their idiocy but cobbling together Spring isn't fun either.