Multiple connection pools dynamically - Java EE
I have a single host server that is servicing multiple clients.Depending on who has logged in, I need EJB beans to access different databases (ASP model). For example, if a client logs in thru website A then their beans need to access database A. if a client logs in thru website B then their beans need to access database B. and so on...
Databases A and B might 开发者_开发知识库be the same database server or a different one and has its own connection pool ( currently needs to support both Websphere & Weblogic).
This application written with single connection pool in mind now this needs to support multiple connection pool now.
Current Deployment descriptor for each bean contains following info. jdbc/ConnA javax.sql.DataSource Container
We have beanA calling beanB, BeanC and Bean d and so on.... The deployment descriptor uses transaction type attribute supports, required, requiresNew etc.
How it should be structured? How to make an EJB instance to associate with the pool? or any suggestions to make it work?
All help is appreciated.
Currently you can't do this with the Java EE spec. This is where Spring can help. Look at the dynamic data source routing article.
Is there anything limiting you from creating datasources to all of the databases (with appropriate min connection settings) and then having the application distinguish the different databases or schemas based solely on the JNDI name?
精彩评论