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 51883 articles. 38 followers. Post

9 Replies
165 Views

Similar Articles

[PageSpeed] 44


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

connection pool and transaction for the few connections from pool
hi, I would like to know whether possible or not to make a transaction using db connection pool. I have db connection pool to MS SQL 2000 using Tomcat 5.0's JDBC DataSource (see on : http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations) Below is simple example code which I have. So I need to rollback all data including inserted country and region records to db in case of exception. Is it possible or not and how it is possible? public void methodWithTransaction(){ Connection c = null; ...

Connections and Connection Pools
Suppose I get a connection from a connection pool, and during my use of the connection it goes bad (say, the socket it's using to talk to the database breaks). When I return that connection to the connection pool, will the pool realize it's bad and not reuse it? Similarly, what if I return a connection with an open transaction? Will the pool roll back or commit the transaction before giving it out to someone else? I realize that the answer depends on the connection pool implementation, I'm just looking for what I can generally expect with a modern commercial implementa...

Connection Pooling and Persistent Connections
Wonder if anyone can help. So, I've read: >> http://uk2.php.net/function.mysql-pconnect >> http://uk2.php.net/manual/en/features.persistent-connections.php Can one seriously see persistent connections as a form of db connection pooling? Is it really similar? Thanks for any clarification from anyone, Cheers Steve. Steve Jenkins <stevejenkins444@hotmail.com> wrote: >>> http://uk2.php.net/function.mysql-pconnect >>> http://uk2.php.net/manual/en/features.persistent-connections.php > > Can one seriously see persistent connections as a form of db &g...

Problem validating connections from connection pool
I'm using MySQL on a Tomcat server with the DBCP connection pool. I'm having trouble setting up the connection pool such that it will validate connections. I initialized the connection pool object in an xml file like this - <bean id="my-datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy- method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="${jdbc.url}"/> <property name="username" va...

most efficient way to get a connection from a connection pool
Having recently load-tested the application we are developing I noticed that one of the most expensive (time-wise) calls was my fetch of a db-connection from the defined db-pool. At present I fetch my connections using : private Connection getConnection() throws SQLException { try { Context jndiCntx = new InitialContext(); DataSource ds = (DataSource) jndiCntx.lookup("java:comp/env/jdbc/txDatasource"); return ds.getConnection(); } catch (NamingException ne) { myLog.error(this.makeSQLInsertable(&q...

Connection pooling & serializing connection for parfor
Hello, I'm writing a matlab program that fetches lots of data from a database. Given the structure of the tables and the nature of the data, I'm forced to run multiple queries multiple times. For instance, I may decide that I want to get a dozen attributes for each of 1000 stocks. Getting each attribute requires a separate DB query. In order to get better performance, I'm using a parfor loop to loop through the 1000 stocks and fetch data. Since I'll have multiple parallel loops getting data, I don't want to have them all use a single connection, and so I create...

Handling invalid database connections from connection pools
I am currently developing a web app using WSAD 5.1 and DB2 V7.2.8. I understand there is a myriad of database errors related to obtaining valid connections that are mapped directly to com.ibm.websphere.ce.cm.StaleConnectionException. There are apparently two solutions to ensure a valid connection is obtained from a WebSphere dataSource. The first is to catch StaleConnectionExceptions and attempt to execute the transaction again a finite number of times. The second is to configure WebSphere to test each connection as they are obtained. See link http://publib.boulder.ibm.com/infoce...

New Connection pooling => Apache Connects Maxing out ?
Hello, With some great help from this list the other night I implemented connection pooling on Tomcat using the commons-dbcp package. I am using Tomcat 4.0.4 That seemed to work fine and there are no problems in testing but as soon as I put it live the number of Apache processes rockets through the roof and apache stops accepting connections. The log file says "MaxClients" reached. This was no problem as MaxClients was set to 20 which was fine with the old (non connection pooling) .war file. So I set up MaxClients to 256 and restarted, now the problem happens agai...

Connection Pool
I searched few post here, and some other group, but I think, Concepts of Connection pooling is discussed very little. having some basic query. 1. creating N thread, every thread blocks on accept, do some work, close connection and again accept (Richard Stven's TCP PreThreaded Server, per-Thread accept) can this be considered as connection pool ? *** thread is closing fd return by accept and doing new accept without calling pthread_exit,*** --Raxit "Sheth Raxit" <raxitsheth2000@yahoo.co.in> writes: > I searched few post here, and some other group, but I think...

Connection pooling
Hi, I'm using ASP 3.0 and ADO with a web based MS SQLServer 2000 database.Web page forms collect criteria for SQL queries (dynamic SQL?). These are mostly Select queries to return inventory lists. Inventory details are posted by means of Insert Update and Delete queries. All connections use the same connection string. A new connection is opened each time the data is accessed and closed and set to null/nothing afterwards. If site traffic becomes high will connection pooling be handled automaticaly (by MTS)? Many thanks Ray Allison Ray Allison (ray.allison@tiscali.co.uk) writes:...

Connection pool
Is anyone aware of a means of connection pooling (to MySQL, say) in php? Thanks, Ike Ike wrote: > Is anyone aware of a means of connection pooling (to MySQL, say) in php? > Thanks, Ike Yes Thanks, C Carved in mystic runes upon the very living rock, the last words of Colin McKinnon of comp.lang.php make plain: > Ike wrote: > >> Is anyone aware of a means of connection pooling (to MySQL, say) in php? >> Thanks, Ike > > Yes Well, aren't you just the clever boy this evening? You must be so pleased with yourself. -- Alan Little Phorm PHP Form Process...

Connection Pooled
I want to use connection pool just like those mensioned in the following link but for MSSQL and MySQL. Do I have to depend on the vendor package? http://www.lc.leidenuniv.nl/awcourse/oracle/java.920/a96654/connpoca.htm#1057365 SK Shinya Koizumi wrote: > I want to use connection pool just like those mensioned in the following > link but for MSSQL > and MySQL. Do I have to depend on the vendor package? > > http://www.lc.leidenuniv.nl/awcourse/oracle/java.920/a96654/connpoca.htm#1057365 > > SK You would need Driver for ms sql which you can get from http://jtds.sourcefo...

Connection Pooling
What is the best way to create/get a database pool for a serious web application? Chase Preuninger wrote: > What is the best way to create/get a database pool for a serious web > application? Use the database connection pool capability in the app server. Tomcat, JBoss, WebSphere, WebLogic etc. all supports it. Arne On May 25, 1:49 pm, Arne Vajh=F8j <a...@vajhoej.dk> wrote: > Chase Preuninger wrote: > > What is the best way to create/get a database pool for a serious web > > application? > > Use the database connection pool capability in the app server. >...

Pool of connection
I'm a begginer in java and connection to database. I'm a vb6 programmer and I use ADO. What is the equivalent in Java? I heard about pool of connection, what are the best approach to connect efficently to a database? Thanks you are on right way use pool of connection http://jakarta.apache.org/commons/dbcp/ sp wrote: > I'm a begginer in java and connection to database. > I'm a vb6 programmer and I use ADO. > What is the equivalent in Java? > I heard about pool of connection, what are the > best approach to connect efficently to a database? > > Thanks...

Pooling of connections
Hi all, I've read a few articles about how pooled connections are more efficient because you don't need to repeatedly setup/teardown a connection - you just acquire connection from the pool. Exactly what steps in setting up/tearing down a connection are skipped by acquiring an already existing connection? Perhaps the steps in establishing/tearing down a connection would help in answering this question? Thanks Taras On Apr 22, 11:49 pm, Taras_96 <taras...@gmail.com> wrote: > Hi all, > > I've read a few articles about how pooled connections are mo...

Connection pool.
I have an application that does database access from multiple threads. The DBMS I'm using serializes queries on the same connection, so I can best take advantage of this by making sure simultaneous queries use separate connections. I can't associate a connection with each thread, however, because my data-access layer abstracts away the fact that there's a database at all, and I have no way of tracking thread context data and passing it to the database access code, e.g.: class DataItem { public: virtual int getSomething () = 0; virtual int getAnotherThing () = 0; };...

Connection Pool
How can I make sure when using the connection pool( see the link below ) and closing the logical connection, I am not actually cutting the phygical connectoin? Is there any way to monitor the connection from perticular computer( Application Server) in oracle? http://www.lc.leidenuniv.nl/awcourse/oracle/java.920/a96654/connpoca.htm#1057365 ...

pool connections
Hi all, I'm working with asp.net+Oracle and I need to know if exist a tool to monitorare the pool connection. we have a max. of 500 users using the system symultaneously and I don't know what max pool size I need for it. thanks for help Fabio ...

About connection pooling
Hi, Could somebody explain the connection pooling for me a bit more? Or to be specific, how do I obtain the correct connection pooling for my servlet. I am using jTDS (1.1) driver to connect MS SQL Server and Apache Tomcat (5.5) to keep my servlet serving and I use Jakarta redirector for IIS to redirect servlet requests to Tomcat. The actual app is an Applet. I have been aware of connection pooling and the benefits of pooled connections. Every time I read about this subject I get a different answer(!). So here is what I have found out: (the question mark stands for your co...

java.lang.NoSuchMethodException when trying to connect to DB2 with a connection pool
Hi, I've set up a DB2 8 database and I'm trying to connect to it with Sun ONE webserver 6.1 on AIX 5.2. When I test the webapp I get "auth failed server does not support this method/mechanism". After looking into it I found out the server only allows "Username only authentication" After adding "SecurityMechanism" to the Connection Pool parameters I get java.lang.NoSuchMethodException: com.ibm.db2.jcc.DB2SimpleDataSource.setSecurityMechanism(boolean). I'm not sure why it's sending the 4 as a boolean rather than as an int or short. ...

Pooled Connection
Hi hope someone can solve this one, I'm using a JNDI datasource to create pooled connections to a 9i DB. In my Java code I'm using an OracleConnectionCacheImpl to attache to this. My problem is that I want to open X number of connections to the database with on startup, but when I connect from withing java using the Connection object specify a user name and password, to perform the query with. When I try this I get the following error message: User credentials doesn't match the existing ones Thanks Ed ...

Connection Pooling
We are using the odbc driver "INFORMIX 3.31 32 bit" The version is 3.31.000 2.40.TC1 When I look at it the set up for it in ODBC drivers, it says <not pooled> under the connection pooling heading. Yet, when I close a connection in a program, my temp tables do not drop. That is, if I specifically say "pConn->Close();" and then exit the ap and rerun it, I get "table blah exists in session". Someone here told me COM always pools connections, but It would seem that they are talking about ASP connections. It's not big deal to tell progr...

tonmcat and connection pooling
Hi, finally after many time I've configured a pool manager underTomcat. Now I have a question:in the <Resource> element I write the attributes username, passwordbut in my application I want thatthe user pass it dinamically so I removed them and I write in theattribute auth="Application" but If I use the following method:Context ctx = new InitialContext();DataSource ds = (DataSource)ctx.lookup( "jdbc/test" );conn = ds.getConnection(user, pass);I have the following error:MESSAGE: Access denied for user ''@'localhost' (using password: NO) Any idea?or ...

about the connection pool in j2ee
In j2ee admin console, Resource -> JDBC -> Connection Pools In the Pool Settings section, i can define two parameters and description of each parameters are defined like the following . Max Wait Time: Amount of time caller waits before connection timeout is sent Idle Timeout: Maximum time that a connection can remain idle in the pool. (default is 300) and i want to ask about this "Max Wait Time". This is period of time caller waits until there is a available connection in a pool? Just looking at the description it's not that clear for me. Can someone clarify this? T...