This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes connection pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "connection pooling " Watch "connection pooling " New topic
Author

connection pooling

Mariya Antony christopher
Ranch Hand

Joined: Jan 24, 2012
Posts: 49

I have developed the application using struts 1.1 with connection pooling
In every code ,i close the context ,

try
{
ctx=new InitialContext();
DataSource ds=(DataSource)ds.lookup("java:comp/env/jdbc/myAPP");
}
finally
{
ctx.close();
}
.
.
.

is't possible to close the resultset,connection ,statement properly otherwise it leads to memory leak
it's very urgent suggest your comments

William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

Please explain your problem better.

WP
Mariya Antony christopher
Ranch Hand

Joined: Jan 24, 2012
Posts: 49

William P O'Sullivan wrote:Please explain your problem better.

WP


how to avoid memory leak in connection pool
Martin Vajsar
Bartender

Joined: Aug 22, 2010
Posts: 2382
    
    3

You'll prevent memory leaks by properly closing all JDBC resources. This is the same regardless of whether you use a connection pool or not.

Some connections (and perhaps connection pools) cache some expensive resources (eg. PreparedStatements), this is certainly the case for Oracle connections. You can alter this behavior by properties or driver specific methods on the connections, and it is usually described in the documentation. This might look like a memory leak, as the memory consumption of the connections in the pool rises as the resources are cached.
Mariya Antony christopher
Ranch Hand

Joined: Jan 24, 2012
Posts: 49

Martin Vajsar wrote:You'll prevent memory leaks by properly closing all JDBC resources. This is the same regardless of whether you use a connection pool or not.

Some connections (and perhaps connection pools) cache some expensive resources (eg. PreparedStatements), this is certainly the case for Oracle connections. You can alter this behavior by properties or driver specific methods on the connections, and it is usually described in the documentation. This might look like a memory leak, as the memory consumption of the connections in the pool rises as the resources are cached.


Thanks for your valuable information
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: connection pooling
 
Similar Threads
Question3 for IBM Test 340
How do you connect to database(sql) from an ejb application
Transactions in Tomcat
How to use connectionpooling for a datasource
datasource?