0 Replies Latest reply on Nov 12, 2003 10:35 AM by mygoditsmoggy

    Multiple Datasource lookups

    mygoditsmoggy Newbie


      Each method I have in my bean uses JNDI to get a connection from the Datasource. The Connection is a global member in my Bean.

      My question is : If I do the following in each method to set my global Connection con member, am I getting each time a new Connection object from the Data pool or am I using the same connection?

      InitialContext ic = new InitialContext();
      DataSource ds = (DataSource) ic.lookup(DBNAME);
      con = ds.getConnection();


      I am asking this to better design my code but also because I am using a transation in one bean which calls method in two other beans and I want to know if there are multiple connections for the transaction to handle.

      Any info on this would be appreciated

      thanks

      David