1 Reply Latest reply on Jan 5, 2006 10:02 AM by Joan Bordeau

    connection to multiples databases dynamically with EJB3

    Joan Bordeau Newbie

      Hello everybody,

      JBoss 4.0.3SP1
      EJB3 RC3

      I use the EJB3 persistance with one database. That is works. But actually I have one database by client. Therefore, I need to connect (disconnect) at multiples databases according to the client.
      For example :
      1) a client X asks to me a jobs list. I have to connect to database of client X.
      Then
      2) a client Y asks to me his jobs list. I have to connect to database of client Y.
      etc.. for every client.

      I dont know how to do. I looked at wiki, forum.
      I think it has to do some modifications in datasource, then the look up in EJB Session and specify the database name for example.
      I may also create a datasource for each database and referenced them in persistence.xml file. But it is not acceptable, because we have many database and we create often new databases.

      Have you any suggestions ???