Couple thoughts: Make it a deployment issue rather than a runtime issue. That is, it is likely that once you've deployed to a particular container instance then that container intance will likely be configured with a predictable datasource(s) to go against. Two solutions: 1. Update deployment descriptors at deploy time. Use a "Replace" command within Ant (or Make if that's what you use) to dynamically configure the deployment descriptors at deploy time. Have it perform a search/replace against the xml files before packaging the components for deployment. Read the values for each particular deployment from a deployment-specific property file. This assumes you are dynamically generating JAR, EAR, WAR files using your build tool (i.e. Ant or Make). The automated process would be something like: - Compile code - Copy .class files to a work area for JAR/WAR'ing - Copy deployment descriptors to work area - Work area should now reflect structure of JAR/WAR file - Run Ant "Replace" command (or similar make command) against the xml descriptors to get correct value for deployed datasources - Execute "jar" command to create JAR/WAR file. - Package into EAR file when finished with all components. (may be simpler ways, but those are roughly the steps) 2. Don't change deploy descriptors. Change where the container thinks each datasource is. This means to not change the data source names in the deployment descriptors at all - just register datasources with the container at deploy time and specify the appropriate jdbc parameters to point to the right place at that time. Again this can be handled from Ant or Make and fed from a properties file. (This approach is the one I personally have used.) I recommend the second approach. It allows you to not have to have to build ear files at deploy time and lets you reuse a particular ear file on more than one host. Simply have your deploy script change the jdbc paramters defining where the data sources point to. This of course requires that your container have command-line utilities for data source registering and configuration. If this is really a run-time and not a deploy-time requirement please respond. - --- "Nimmons, Buster" <[EMAIL PROTECTED]> wrote: > Currently we have 30 or so container managed entity > beans all reffering to > the same datasource in there deployment descriptor. > > Is there anyway to assign which datasource to use at > runtime for container > managed beans. We are running into a situation where > we have 12 different > projects all using identical but seperate databases. > We would like determine > at runtime the project the user needs information > from and programatically > have the container change datasources in which it's > populating beans from. > __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
