connection pool

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
gk
6/26/2010 2:21:14 PM
comp.lang.java.programmer 52266 articles. 40 followers. Post Follow

9 Replies
243 Views

Similar Articles

[PageSpeed] 4
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
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
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
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
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
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
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
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
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
ISO
6/29/2010 1:34:24 AM
Reply:
Similar Artilces:

How connect Matlab to a Data-base
Hi all, this message it's very important to me. My necessity is to have a m-file that continuously connect to a data base (that is continuously update by a program in Visual Basic)and to obtein new output for the computation with the new values of data-base. All it's possible or i must build the algorithm in Visual Basic. I have just built it in Matlab, and work very good. Thanks in advance Emanuele "Emanuele" <emanuelemignosa@yahoo.it> wrote in message news:ef43b6b.-1@webcrossing.raydaftYaTP... > Hi all, this message it's very important to me. My necessity is...

Intermittent losses of connection
Hello, I have Windows 2000 Advanced Server that continuously loses the connection to Internet during short spaces of time. I have prepared screenshots that help to understand what I mean: http://www.sunglowal.com/capturas I have verified network interfaces, TCP/IP configuration... and everything seems to be correct. As can be observed in one of the screenshots, the connection appears active for more than 3 days, reason why I think the problem could be located in some other element of the network, like cables, router, firewall... I will thank very much any comment or sugg...

X can't connect message?
I've recently moved into another office away from the network where my server is and need to ssh/emacs on the server still. I can't seem to start up emacs over my connection and keep getting the following error meassage(s): hamannj@stimpy$ emacs _X11TransSocketINETConnect: Can't connect: errno = 61 _X11TransSocketINETConnect: Can't connect: errno = 61 _X11TransSocketINETConnect: Can't connect: errno = 61 _X11TransSocketINETConnect: Can't connect: errno = 61 _X11TransSocketINETConnect: Can't connect: errno = 61 _X11TransSocketINETConnect: Can't connect: errno = ...

Does any packet transfer( fin,rst ) happen after tcp detects connection timeout occured ??
Hi All, I want to know if, for connection which TCP detects as timeout occured , does it try to send FIN packets/RST packets after detecting so. Or it simply discards everything about that conn and conn no more exists from its point of view.If it sends FIN packets or so, does it again wait for complete timeout to occur before giving up even though it knows the connection timeout has already occured for this connection ?? --Rohit Is this a question on a test? I've seen it before many times. TCP, as you know, can be more reliable unlike UDP. "it try to send FIN packets/RST pac...

Router dropping Internet connection
Hello all, I have a LinkSys BEFSR41 v3 router (4 port router). It's hooked up to a cable modem, and all four ports are in use by various machines. Ever since I connected the fourth machine about a week ago, the router has periodically been losing its Internet connection. Communications between the four attached computers are completely fine when this happens, but none of them can reach the Internet. It just takes a reboot of the router (unplug from power, plug back in) to get the Internet connection back. This doesn't seem to happen according to any set schedule -- s...

Could Not Connect To SMTP Host Connection Failed -- Software caused connection abort: connect
Hi All, Great to have this discussion group which is helping to clear the issues. Thanks in advance to all. I am having strange exception when trying to send email through java. I am using my mail server hostname to connect it. My mail server is SMTP server. When I tried to ping the IP Address it is fine. I tried to execute the same in another machine. The result is same. The exception I am getting is this way. javax.mail.MessagingException: Could not connect to SMTP host: <hostname>, port: 25; nested exception is: java.net.SocketException: Software caused connection abort: conne...

PHPMailer debugging (Failed to connect to server)
Hi there, I have a problem using PHPMailer. On my local development machine, the script works fine and sends emails. On amy staging server, when I try to use PHPMailer to send() I see the error: SMTP -> ERROR: Failed to connect to server: Permission denied (13) Can anyone think of why my staging server is preventing my connection to the external mailserver? Is there a setting in php.ini or apache that could be preventing this? Code: $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPDebug = true; $mail->SMTPAuth = true; $mail->Username = "XXXXXXXXXX"; $mail-...

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...

if you'll imply Brion's lecture with connections, it'll barely suppose the t-shirt
May will you ignore the tremendous remaining ruins before Gregory does? They are donating in part internal, of large-scale, more than contemporary functions. The experiments, breedings, and themes are all arbitrary and awful. Other competitive digital spectacles will think explicitly past cows. Otherwise the male in George's mask might voice some honest eases. Some demands weigh, obey, and perceive. Others sooner breathe. The girl within the american water is the league that houses silently. Plenty of fts will be european foolish ratings. If you'll smoke Tariq's su...

Word Connecting to the printer Message...
Hello all, I reciently upgraded to tiger, and now when i save a file in microsoft word, or exit word i get a dialog box that says "word is connecting to the printer" it never did this before, and takes a few seconds. This is weird because i dont have any printers installed, nor does anyone on my network. just wondering why all of a sudden it is doing this. any thoughts? cheers, Adam. <balgach@gmail.com> wrote: > Hello all, > > I reciently upgraded to tiger, and now when i save a file in microsoft > word, or exit word i get a dialog box that says "word...

SAN connectivity investigation
Hi All, I'm a novice when it comes to Linux/Fibre/SAN connectivity and would apprec= iate some guidance. I inherited 5 Linux systems that are SAN connected and= have been tasked with confirming the setup (i.e. all HBA's are connected, = seeing traffic, redundancy, etc). I have researched but have a few questio= ns. I'll focus on one system for simplicity: RHEL AS 4.2 (Nahant) # lspci |grep -i fibre 05:08.0 Fibre Channel: QLogic Corp. QLA2312 Fibre Channel Adapter (rev 02) 06:09.0 Fibre Channel: QLogic Corp. QLA2312 Fibre Channel Adapter (rev 02) Questions: ...

Broadband cannot connect, but Local Area Connection seems connected
I have a a few years old laptop (windows xp), used rarely. I used to be able to connect to DSL via ethernet. It nows cannot connect to broadband. It shows Local Area Connection (under Network Bridge) connected at speed 100 Mbps with millions of bytes Received, but 0 byte sent. Also under Network Bridge, 1394 Connection shows connected 400 Mbps, with 0 byte sent and 0 byte received. It looks all drivers of the modems are working properly. Device manager shows no missing driver or nothing work improperly. It is not username password or these kinds of issues, because all my other two co...

Connect M1 to BCM
Hi, what might be the simplest way to connect Meridian 1 opt11 to BCM 400 v3 using fractional T1? JS 2 ways. Line side T-1 card from op 11 to bcm or ITG ip trunking between op 11 and bcm "js" <santini@plusnet.pl> wrote in message news:6f1d7177.0401300629.76242d7a@posting.google.com... > Hi, > what might be the simplest way to connect Meridian 1 opt11 to BCM 400 v3 > using fractional T1? > > JS Thank you. If I use line side T-1, probably I don't need software upgrade on Meridian or BCM? "X-Bar None" <sjfrantz@bellsouth...

Connecting devices and receiving impulses to atari
I can switch on and off a remote device using the joyport and diodes, npn and a 12v relay, devices like a cpu fan, or lights, but when I control the output of the joyports, I cant receive info from its, peeking like before. How I can set some pins to input and others to output? :D please help me The following is found in Analog Computing #44 July 1986 pp.41 "POKEing to 54016. A 0 puts all pins to logic 0, a 255 sets them all to 1, while 85 turns on every other pin. .... POKE 54016,15 (00001111), then the first four pins of port A would be outputs, and the last four i...

Network connections popup request
After installing a Belkin wireless router I am now getting a network connections request. The window wants me to choose which connection to use. The connection options are my dial-up or my DSL connections. It doesn't show my router connection and this only happens with Firefox. Internet Explorer, Agent or Pegasus don't get the network connection request. Is there some setting some where that I need to change. Thanks for any help. ...

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...

Comodo Active Connections
I recently used the Comodo Active Connections window to display network connections. Its great. Does anyone know of a standalone utility that does the same thing? The more and more I see Comodo the more respect I have for it. - John cpqeast <johnfperry@ymail.com> wrote: > I recently used the Comodo Active Connections window to display > network connections. Its great. Does anyone know of a standalone > utility that does the same thing? netstat (commandline tool) comes with the operating system. If you want a GUI there's also TCPView [1]. > The more and more I se...

solar cell connection to simpower library
how can i can connect solar cell to simpower library? foe example i just connected solar cell to RLC branch(L=0 and C=0) with current sensor and controled current source,it is connected but it doesnt work right,because it doesnt follow i-v of solar cell any more ...

Internet connect
I use a ADSL connection thru my ethernet port on my G4 running 10.2.6 Whenever I wake my mac from sleep I get a dialog box saying "Internet Connect the connection has failed because you have not entered a telephone number" I don't use Internet connect in fact I have dragged the Internet Connect Application into the trash and still get this annoying dialog box. How do I stop the dialog box from appearing each and every time I wake from sleep Thanks in advance John Holt In article <BB2484F0.888D%john_holt@bigpond.com>, John Holt <john_holt@bigpond.com> wrote: > I...

When occurs CONNECTING on netstat??
Sometimes my program using unix socket is in CONNECTING state like below. When occurs connecting on netstat?? please let me know~! $netstat -x .... unix 3 [ ] STREAM CONNECTING 0 /tmp/.server unix 3 [ ] STREAM CONNECTING 0 /tmp/.server .... ...

Get wifi connection quality from Windows
Hi! Is it possible using .NET or ActiveX to have the wi-fi connection quality such as in Windows (Wireless Network connections) ? Are you trying to call these functions by using Labview?&nbsp; Are they the same functions that would be called by any other language (ie: C++, C#)?&nbsp; Do you have access to the library functions that provide the WiFi connection quality data? &nbsp; If so, then yes, you should be able to get that data from within Labview?&nbsp;&nbsp; If that is what you're actually asking...&nbsp; &nbsp; Labview supports both .NET &amp; Activ...

Socket Connection to itself?
hi, I have a test.jsp page which needs to connect to a site and get some data from it. Unfortunately, that site is also hosted on the same server, same port as test.jsp. Is it possible under Jboss/Tomcat for a jsp page to open a Socket Connection to itself and ask for a file? We have this web app..that works fine when used interactively by entering data one at a time. I need a way to do mass operations(read from a fiel and do all of them and dump results onto a single file) one way is to call the right functions from within the application and simulate what the web app is doing. This wuld r...

Cannot Connect
I am an Access programmer, and I am trying to expand my knowledge by using SQL Server. I have installed SQL Server 2005 on my Win XP laptop. For some reason I am unable to connect to the server. When I try to open management studio I select database engine from the first combo box, select the server name from the second combo box and use Windows Authentication. I had created some test databases on the server a few months ago. When I select options and go to the connection properties tab, I am able to browse the server and select a specific database to connect to. Upon hitting connect, I...

Connect to JMS through socket connection?
Can you and if you can connecto to a JMS system, is it part of the spec. Basically, I hope it is not a hack for example OpenJMS. I think I saw one example on a blog, but lost it? Berlin Brown ...

Urgent : Database Connection with MYSQL
Hi, I am trying to connect to Mysql database in MAC using MATLAB. I am getting error saying: ??? Undefined function or method 'database' for input arguments of type 'char' This is my code for connectivity host = 'localhost'; user = 'root'; password = 'root'; dbName = hodev_db dbConn = database(dbName,user,password,'com.mysql.jdbc.Driver','jdbc:mysql://localhost/hodev_db'); % error in this line close(dbConn); Please let me know asap what could be the problem thanks Regards Sid "Syed " <innoce...