The jca spec explicitly says in several places that a deployed connection factory is expected to communicate with only one EIS instance, and that connection properties you supply should not include urls etc to specify which EIS instance to use.
Your proposal doesn't make sense to me yet. How exactly are you determining which database to access? If you supply enough info I may be able to suggest a way to do what you want.
For instance, Dan Bunker wrote a modified adapter that supplied connections to different databases depending on the security info of the caller (different users get different dbs).
I agree that it may sounds like a strange scenario and I just reached the same conclusion as you.
The problem is that our database is partitionned horizontally mainly for performance reason, also because we have some legacy software that works with these databases and to allow some scenario that we have in mind.
Thus the database containing the bean is known in the session that wants to instantiate it. We don't need to pass an url but just some data from which we are able to retrieve the Database.
At this time the only solutions are BMP or SB with direct connection. I checked the code and did not find other easy way to do it.
The adapter of Dan Bunker may be a solution if we are able to pass other data than just the security info which is not sufficient. Our partitionning does not depends on the user. Is this code available somewhere ?
unfortunately Dan's code is stuck on my laptop which is having network problems at the moment.
I don't think a fancy datasource will help you unless you can figure out a way to call the entities with different security information depending on which db you want to use.
How about deploying the entity beans multiple times, once per database, under different jndi names? Then you can look up the home depending on which db you want, but the Home interface will always be the same.