connection pool

Discussion in 'Java' started by gk, Jun 26, 2010.

  1. gk

    gk Guest

    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 ?
     
    gk, Jun 26, 2010
    #1
    1. Advertising

  2. gk

    Lew Guest

    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.

    --
    Lew
     
    Lew, Jun 26, 2010
    #2
    1. Advertising

  3. gk

    Arne Vajhøj Guest

    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
     
    Arne Vajhøj, Jun 26, 2010
    #3
  4. 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/
     
    Robert Klemme, Jun 26, 2010
    #4
  5. gk

    gk Guest

    On Jun 26, 8: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.
    >



    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
     
    gk, Jun 27, 2010
    #5
  6. gk

    gk Guest

    On Jun 27, 7:32 pm, gk <> wrote:
    > On Jun 26, 8: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.

    >
    > 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
     
    gk, Jun 27, 2010
    #6
  7. gk

    Lew Guest

    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
     
    Lew, Jun 27, 2010
    #7
  8. gk

    Lew Guest

    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
     
    Lew, Jun 27, 2010
    #8
  9. gk

    steph Guest

    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.
     
    steph, Jun 27, 2010
    #9
  10. gk

    Arne Vajhøj Guest

    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
     
    Arne Vajhøj, Jun 29, 2010
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sean Nolan

    Trap "connection pool" errors

    Sean Nolan, Jul 11, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    396
    David Browne
    Jul 11, 2003
  2. Brian

    Connection Pool Error

    Brian, Jan 10, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,374
    Hermit Dave
    Jan 11, 2004
  3. Linus Nikander
    Replies:
    5
    Views:
    545
  4. Wei  Lu
    Replies:
    2
    Views:
    5,878
    Wei Lu
    Feb 16, 2009
  5. Rick Lawson
    Replies:
    8
    Views:
    809
    Graham Dumpleton
    Jul 17, 2009
Loading...

Share This Page