I have no experience with WebLogic per se, but I can tell you how we've
implemented the connection pool architecture, and I believe most EJB
servers work this way.
Each time you get a connection it comes from a pool, and the pool is
typically shared across all access to the database (though you can have
multiple pools for the same database). Whether you're using
getConnection() in a session bean, BMP or using CMP, you always end up
getting the same connection from the same pool.
There is no way (or need) for you to check if a connection is pooled or
not. It is, always pooled (or should be).
The whole point of connection pooling is that you specify an initial
number of connections which are always kept open for efficiency (say
10), and an upper limit based on what your database can take (it might
be the license, or a technical limit) and the pool will never grow
beyond that.
If your pool starts at 100, the server will try to open up 100
connections on startup and this might kill your EJB server. So you might
want to reduce this number to 10, or 20. The pool can always grow beyond
the start size up to the upper limit.
If your upper limit is 100 (because that's your database license) and
you have 200 entity beans running at the same time, the EJB server
should server only 100 beans and let the remaining 100 wait until a new
connection is available. This is generally known as transaction
processing monitoring, and is part of what an EJB server should do.
arkin
Parikshit Pol wrote:
>
> Hello,
>
> Currently we are testing the performance of ejb's using WebLogic. Here we
>are mainly concerned with creating connections with the database through the Entity
>beans. We specified the initial capacity (number of connections) in the connection
>pool as 100. But it threw a Resource Exception when we started the server. In such
>case what is the solution if I need to increase the number of connections to the
>database. I thought over some solutions, but I would like to receive your feedback
>about the same.I would like the following doubts cleared.
>
> 1. I can use Bean managed Entity bean and in each Entity bean I create a JDBC
>connection to the database.
> But in this case Performance is totally affected as each time I have to create a
>fresh JDBC connection to the database.So this is
> a bad sol.
>
> 2. Can I add connections in the connection pool (Is this possible?).
> Is it possible that I use container Managed Entity bean and I check whether
>a connection is available before getting RI to Entity bean. If the connection is not
>available then can I add connection to the existing connection pool.
>
> 3. When is the ejbCreate called? (after establishing a connection to the db or
>before establishing a connection to the db)
> If a connection is established to the database before calling ejbCreate() can we
>insert the code to check the availability of connections in ejbCreate. If they are
>not available we can create a connection there itself.
>
> What is the no. of connections that are limited in a connection pool.
>
> In our application we will be accessing a third party database. Here the no. of
>users that can connect to the db is limited(users in db).Does this fact also limit
>the connection to db from my beans.Do I have to get more number of users who can
>access the database.
>
> Thanks and Regards,
> Parikshit
>
>
>_____________________________________________________________________________________________________________
> Parikshit Pol
> Systems Executive
> KPIT System Ltd.
> 6,Mayur Colony,
> Karve Road,
> Pune-411029
> e-mail :< [EMAIL PROTECTED] >
> Phone : 91-020-5468654 ext. - 212
>
>_______________________________________________________________________________________________
>
> ===========================================================================
> 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".