Changing a Datasource at runtime( CMP Entity beans)


EJB programming & troubleshooting: Changing a Datasource at runtime( CMP Entity beans)

  1. Changing a Datasource at runtime( CMP Entity beans) (1 messages)

    Consider a hypothetical application that needs to be deployed on a single app server and has to service mulitple clients. Consider that there is a database per client. Thus n databases for n clients. However, all of these database have the same structure, and only the content varies.

    Now to the problem:
      Can I use CMP's in this context where I need to connect to different databases(with absolutely identical structure)
    for each client. Different databases mean different Datasources, hence how do I uniquely associate a CMP Entity Bean with a single table for a particular datasource. Also, we do not want a different entity bean set for each database!

    Also multiple application instances are not alloweded to be deployed on the server(s).

    E.g. Say, clients jerry, larry and harry, use my application. Each one has his own database say jerryDb, larryDb and harryDb, these are also their datasource jndi names.
    The databases ofcourse have an identical structure, just that they are named differently. Since I want to keep only one instance of application deployed, is it possible to use CMP Entity beans, and service all the three clients with their respective data.

  2. Swatkat,

    It's not possible to change CMP datasources on the fly. You will have to deploy the application per client database.


    Slava Imeshev