1 Reply Latest reply on Mar 1, 2005 5:42 AM by Steven Peh

    Multiple Databases

    Deon Moolman Newbie

      We're looking into building a system using j2ee - we'd like to leverage EJB3 for its coding simplicity but need to be application server and database independant..

      Our current hurdle is this : We want to host multiple databases on a single server, single jboss installation, single codebase such that the hostname gets mapped to a database name through a configuration file. ie. If a user connects to a machine via the hostname 'test', then it should use the 'test' database, if they connect via the hostname 'work' it would use the database 'workserv' (or whatever, you get the idea).

      All help and ideas would be appreciated.

      Thanks

        • 1. Re: Multiple Databases
          Steven Peh Newbie

          when you say 'users connect to the machine via the hostname'.. by what protocol? Http? If so, i believe servlets can get the URL of the request, so just parse the URL for the hostname and forward it to your ejbs then let your ejbs use the appropriate datasource or dao based on the hostname to db mapping in your config/properties file. Cheers.