connection pool

  • Permalink
  • submit to reddit
  • Email
  • Follow


We write

Context ctx = new InitialContext()
javax.sql.DataSource ds = (DataSource)ctx.lookup("jdbc/oracleLink");
Connection con = ds.getConnection();

We get connection now.  Is there any way to get  minimum, current and
maximum number of  connections in the pool at this part ?
0
Reply gk 6/26/2010 2:21:14 PM

See related articles to this posting


gk wrote:
> We write
>
> Context ctx =3D new InitialContext()
> javax.sql.DataSource ds =3D (DataSource)ctx.lookup("jdbc/oracleLink");
> Connection con =3D ds.getConnection();
>
> We get connection now. =A0Is there any way to get =A0minimum, current and
> maximum number of =A0connections in the pool at this part ?
>

I don't see a way using the java.* or javax.* SQL APIs.  This part
would be the wrong place for that information anyway.

The whole point of connection pools is to provide the pooling facility
transparently, that is, in a way that looks to the application just
like a non-pooled connection.  The segregation of pooling capability
from normal DataSource and Connection usage is deliberate.

There probably is a way using driver-specific calls.  WebLogic has
management beans that can reveal this information:
<http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13951/core/
index.html>
Click on "JDBCConnectionPoolParamsBean"

Meta-information about the connection should be logically separate
from actual use of the connection.

--
Lew
0
Reply Lew 6/26/2010 3:20:00 PM

On 26-06-2010 10:21, gk wrote:
> We write
>
> Context ctx = new InitialContext()
> javax.sql.DataSource ds = (DataSource)ctx.lookup("jdbc/oracleLink");
> Connection con = ds.getConnection();
>
> We get connection now.  Is there any way to get  minimum, current and
> maximum number of  connections in the pool at this part ?

A regular app should not change behavior based on that information,
so it is not necessary.

If you are writing an app server management app, then it will be
app server specific and you can cast the connection to its
implementation class and access all types of extra information
available.

Arne


0
Reply ISO 6/26/2010 3:57:40 PM

On 06/26/2010 05:20 PM, Lew wrote:
> gk wrote:
>> We write
>>
>> Context ctx = new InitialContext()
>> javax.sql.DataSource ds = (DataSource)ctx.lookup("jdbc/oracleLink");
>> Connection con = ds.getConnection();
>>
>> We get connection now.  Is there any way to get  minimum, current and
>> maximum number of  connections in the pool at this part ?
>>
> 
> I don't see a way using the java.* or javax.* SQL APIs.  This part
> would be the wrong place for that information anyway.
> 
> The whole point of connection pools is to provide the pooling facility
> transparently, that is, in a way that looks to the application just
> like a non-pooled connection.  The segregation of pooling capability
> from normal DataSource and Connection usage is deliberate.
> 
> There probably is a way using driver-specific calls.  WebLogic has
> management beans that can reveal this information:
> <http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13951/core/
> index.html>
> Click on "JDBCConnectionPoolParamsBean"
> 
> Meta-information about the connection should be logically separate
> from actual use of the connection.

Similar in JBoss which exhibits an MBean providing information about a 
pool's state.

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
0
Reply Robert 6/26/2010 7:45:39 PM

On Jun 26, 8:20=A0pm, Lew <l...@lewscanon.com> wrote:
> gk wrote:
> > We write
>
> > Context ctx =3D new InitialContext()
> > javax.sql.DataSource ds =3D (DataSource)ctx.lookup("jdbc/oracleLink");
> > Connection con =3D ds.getConnection();
>
> > We get connection now. =A0Is there any way to get =A0minimum, current a=
nd
> > maximum number of =A0connections in the pool at this part ?
>
> I don't see a way using the java.* or javax.* SQL APIs. =A0This part
> would be the wrong place for that information anyway.
>
> The whole point of connection pools is to provide the pooling facility
> transparently, that is, in a way that looks to the application just
> like a non-pooled connection. =A0The segregation of pooling capability
> from normal DataSource and Connection usage is deliberate.
>
> There probably is a way using driver-specific calls. =A0WebLogic has
> management beans that can reveal this information:
> <http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13951/core/
> index.html>
> Click on "JDBCConnectionPoolParamsBean"
>
> Meta-information about the connection should be logically separate
> from actual use of the connection.
>


I checked that link .  I did not find "JDBCConnectionPoolParamsBean"
in the page . I also expanded the  Left Hand Side collapsible + menu
for 'Runtine MBeans'  but  did  not find
"JDBCConnectionPoolParamsBean" .

Could you please forward me the direct link ?  or tell me the steps
where to find it.
I would be glad to work out this for weblogic server.

Regards

0
Reply gk 6/27/2010 2:32:02 PM

On Jun 27, 7:32=A0pm, gk <src...@gmail.com> wrote:
> On Jun 26, 8:20=A0pm, Lew <l...@lewscanon.com> wrote:
>
>
>
>
>
> > gk wrote:
> > > We write
>
> > > Context ctx =3D new InitialContext()
> > > javax.sql.DataSource ds =3D (DataSource)ctx.lookup("jdbc/oracleLink")=
;
> > > Connection con =3D ds.getConnection();
>
> > > We get connection now. =A0Is there any way to get =A0minimum, current=
 and
> > > maximum number of =A0connections in the pool at this part ?
>
> > I don't see a way using the java.* or javax.* SQL APIs. =A0This part
> > would be the wrong place for that information anyway.
>
> > The whole point of connection pools is to provide the pooling facility
> > transparently, that is, in a way that looks to the application just
> > like a non-pooled connection. =A0The segregation of pooling capability
> > from normal DataSource and Connection usage is deliberate.
>
> > There probably is a way using driver-specific calls. =A0WebLogic has
> > management beans that can reveal this information:
> > <http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13951/core/
> > index.html>
> > Click on "JDBCConnectionPoolParamsBean"
>
> > Meta-information about the connection should be logically separate
> > from actual use of the connection.
>
> I checked that link . =A0I did not find "JDBCConnectionPoolParamsBean"
> in the page . I also expanded the =A0Left Hand Side collapsible + menu
> for 'Runtine MBeans' =A0but =A0did =A0not find
> "JDBCConnectionPoolParamsBean" .
>
> Could you please forward me the direct link ? =A0or tell me the steps
> where to find it.
> I would be glad to work out this for weblogic server.
>
> Regards

I have found this here ...

http://download.oracle.com/docs/cd/E11035_01/wls100/wlsmbeanref/core/index.=
html

I see it has

InitialCapacity  --This is also the minimum number of physical
connections the connection pool will keep available.

MaxCapacity -- The maximum number of physical connections that this
connection pool can contain.


But there seems NO attribute to tell how many connections are in USE
now .

Is there any way out for this
0
Reply srcjnu (382) 6/27/2010 2:55:27 PM

Lew wrote:
>> <http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e13951/core/index.html>
>> Click on "JDBCConnectionPoolParamsBean"
>>
>> Meta-information about the connection should be logically separate
>> from actual use of the connection.

gk wrote:
> I checked that link .  I did not find "JDBCConnectionPoolParamsBean"
> in the page . I also expanded the  Left Hand Side collapsible + menu
> for 'Runtine MBeans'  but  did  not find
> "JDBCConnectionPoolParamsBean" .
>
> Could you please forward me the direct link ?  or tell me the steps
> where to find it.
> I would be glad to work out this for weblogic server.

Click on the link.
"Configuration MBeans"
"System Module MBeans"
"JDBCConnectionPoolParamsBean"

-- 
Lew
0
Reply Lew 6/27/2010 3:23:19 PM

gk wrote:
>> "JDBCConnectionPoolParamsBean" .
....
> I have found this here ...
>
> http://download.oracle.com/docs/cd/E11035_01/wls100/wlsmbeanref/core/index.html
>
> I see it has
>
> InitialCapacity  --This is also the minimum number of physical
> connections the connection pool will keep available.
>
> MaxCapacity -- The maximum number of physical connections that this
> connection pool can contain.
>
>
> But there seems NO attribute to tell how many connections are in USE
> now .
>
> Is there any way out for this[?]

Dig through the documentation for your DataSource provider.

Why do you want it?

-- 
Lew
0
Reply Lew 6/27/2010 3:24:57 PM

gk wrote:
> We write
> 
> Context ctx = new InitialContext()
> javax.sql.DataSource ds = (DataSource)ctx.lookup("jdbc/oracleLink");
> Connection con = ds.getConnection();
> 
> We get connection now.  Is there any way to get  minimum, current and
> maximum number of  connections in the pool at this part ?

DataSource does not imply a pool of connection.
I is perfectly right to create a datasource with one connection.
0
Reply steph 6/27/2010 10:15:18 PM

On 27-06-2010 18:15, steph wrote:
> gk wrote:
>> We write
>> Context ctx = new InitialContext()
>> javax.sql.DataSource ds = (DataSource)ctx.lookup("jdbc/oracleLink");
>> Connection con = ds.getConnection();
>>
>> We get connection now. Is there any way to get minimum, current and
>> maximum number of connections in the pool at this part ?
>
> DataSource does not imply a pool of connection.
> I is perfectly right to create a datasource with one connection.

Sure.

But a JNDI lookup indicates app server (incl. servlet container only)
context.

And I can not remember one of those that provide data sources
that are not a connection pool.

Arne

0
Reply ISO 6/29/2010 1:34:24 AM
comp.lang.java.programmer 51822 articles. 38 followers. Post

9 Replies
159 Views

Similar Articles

[PageSpeed] 58


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces: