0 Replies Latest reply on Nov 19, 2002 4:06 PM by Wim Lambrecht ('wil')

    advice wanted: webapp jboss DAO multiple databases

    Wim Lambrecht ('wil') Newbie


      This is the situation (the question follows later on ...)
      How should you handle te following situation:
      I'm using: JBoss 2.4.4, MySQL as RDBMS, and apache Cocoon as engine for the web-front end. Cocoon running on Tomcat 4.1.12 (not the one bundled with Jboss, but a separate one). I generate my Session and BMP-Entity beans with 'xDoclet', which also generates corresponding DAO-interfaces. I provided the necessary DAO-implementations (implementing the DAO, providing SQL-statement), in this case MySQL-specific. A user of the webapp provides, via the uri (url) his domain (which in my case means: the database is have to read the data from). The webapp calls some java-class (a facade) which talks to a session-bean. The SBean looks up the correct Entity-bean, which at his turn calls his corresponding DAO-implementation-class which launches sql-queries. The DAO-implementation is

      responsible for making the DB-connection and closing it (looks up the DataSource via JNDI). The data is fetched,

      the Entity bean's state is up-to-date and a value-object, representing this state is returned all the way back

      to the front. The mySQL datasource settings als correctly provided in de jboss.jcml-file.
      Everything works great, but here the desired situation: as i said earlier, the domain to fetch data is provided

      by the user of the webapp (via the uri), e.g.: http://chicago.myserver.com, i this case i have to fetch data in

      'chicago' database, http://lasvegas.myserver.com from the lasvegas database. This is no difference in

      dbms-structure, only the content. All the stuff lying in between this front-end and the very back-end stays the
      I don't want to change the Entity-bean code nor the DAO-code.
      My question is: what's the best way to do this. And how can i 'transport' the 'chicago' of 'lasvegas'-context-string all the
      way to the DAO (where the connection is made). Do i have to provide a Datasource-entry for every database in de
      jboss.conf or are the alternatives.

      Anyone ?