connection pool

G

gk

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 ?
 
L

Lew

gk said:
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.
 
A

Arne Vajhøj

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
 
R

Robert Klemme

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
 
G

gk

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.


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
 
G

gk

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

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
 
L

Lew

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"
 
L

Lew

gk said:
"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?
 
S

steph

gk said:
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.
 
A

Arne Vajhøj

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top