deploy your bean twice under different jndi names and map the ejb names to different datasources in jbosscmp-jdbc.xml
my app only needs to run against 1 database, either mysql OR mssql.
when someone installs my app, the installer CAN setup the app for a given database, by deploying the mssql-version of my jar instead of the mysql-version.
i wish there were a way to deploy one jar somehow with many jbosscmp-jdbc.xml, setup for all databases, similar to the Resource Bundle concept:
resource_en is for english
resource_es is for spanish
... and so forth... they're all deployed together, and the app-server picks the right one at runtime in function of the browser's preferred locales.
so how would the app server choose which database configuration to use?
it would be intrinsic in the deployment:
the app-server would knows only about 1 datasource.
i would accomplish this by deploying only 1 of:
both bound to "java:/DefaultDS".
I'm not sure I'd like that type of implicit behavior -- would seem it is far too easy to connect to the WRONG database and do some damage there.
I rather explicitly bound my datasources to specific names other than DefaultDS.
Not at all from my point of view:
remember that my system has to connect to 1 database, either mysql -or- mssql. in this situation the uniform datasource name allows me to deploy both datasource descriptors, and even if a configuration mistake is made one of the datasources will fail indicating that the jndi name is already in use.
furthermore i deploy the datasources with generic db name/username/password, so the chance of anybody in the world picking my same combination is nil.
but my issue is not how to deploy the datasources, it is on howto deploy the ejb modules that contain jbosscmp-jdbc.xml in a similar fashion.
if noone has any better approach i will deploy 2 jars: each with a jbosscmp-jdbc.xml for that specific database. i only wish that there was a way i didn't have to create a full jar that way, after all the only difference is the 1 xml file (unless some surprise comes later).