Victor,
It probaby would not be a good idea to deploy multiple beans with a
different jndi name and then having logic in a session bean/servlet to call
the appropriate bean. What happens if we have 10 sites (using different
databases) and there are 10 beans in the system. The beans would have to be
deployed 100 times.
I was thinking more in the line of this : Before getting any bean, set a
property which that bean would refer to. What we are doing currently is we
are passing the properties to each and every finder/create methods. Also
before calling the set/get, we first set the connection properties with a
set fn. In ejbLoad, we make sure that if we do not have a valid property
object setup, then do not initialize the bean. This is working fine but I
was thinking that if we could have some kind of properties associated with a
bean which we can set/change at run-time, then it would be cleaner. Can
somebody tell me if this is possible?
thanks.
Raaj.
----- Original Message -----
From: Victor Langelo <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 30, 2000 9:50 AM
Subject: Re: Changng db connection on the fly
> Rajendra,
>
> Most EJB servers support multiple connection pools. Each pool would supply
> connections to a particular database. The connection info for each
database is
> part of the pool definition. You're beans would only need to know from
which
> pool to request a connection. The pool identifier can be saved in a bean
> property. You can pass the pool identifier in the create method of a
session
> bean. For entity beans, the most portable solution would be to deploy the
same
> bean code multiple times with a deployment property identifying the pool.
Then
> the business logic would use the appropriate home depending on the
database
> desired.
>
> --Victor Langelo
>
>
> Rajendra Mishra wrote:
>
> > Hello,
> >
> > I am developing a system in which users would be accessing different
> > database depending upon some selections. The EJB's need to query into
the
> > apropriate datatabase accordingly. The way we are doing it is the
servlet
> > which invokes an EJB methid, passes it a Properties object with all the
> > connection info from the client session(httpsession). The EJB (BMP) gets
a
> > connection from the pool as per the properties passed. This means that
the
> > ejbLoad/ejbFindByPrimaryKey all are dependent on the Properties info
which
> > is stored as a class-member variable. Then, before invoking any remote
> > interface calls, the client has to call a method to set the connection
> > properties again. This whole soln is built on a shaky ground and might
fall
> > once we go into a production environment.
> >
> > I would like to know if we can set some properties which is instance
> > specific to a bean. In other words, one bean might want to connect to a
> > different database than the other depending upon some business logic
before
> > a handle to the home object is looked up. Is this possble? Please help
me
> > with some leads.
> >
> > Thanks.
> > Raaj.
> >
> >
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> > of the message "signoff EJB-INTEREST". For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".