9 Replies Latest reply on Oct 6, 2008 2:46 PM by Jørgen Salomonsen

    How to create database connections per user database account ?

    Jørgen Salomonsen Newbie

      I have an application, with the requirement, that each user should log on using their own oracle database account, i.e. using a seaparate connection with their own username/pasword.


      I'm using the Seam Application Framework generated by seamgen, and I've tried to override
      getPersistenceContext() in EntityHome to first check if there is a new user, and if so,  create a new connection doing something like this:
         


          Session entityManagerDelegate = (Session) entityManager.getDelegate();
          Class.forName(driver); 
          Connection conn = DriverManager.getConnection(url, username, password);
          entityManagerDelegate.reconnect(conn);
      



      However, I got following error:




      java.sql.SQLException: Listener refused the connection with the following error:
      ORA-12519, TNS:no appropriate service handler found.
      





      I haven't been able to find any dokumentation/examples on how to do this in Seam.


      Is there or solution ?


      Or, if it's an antipattern I would very much appreciate an explanation.


      Thanks.