Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connection pooling

 
Mariya Antony christopher
Ranch Hand
Posts: 49
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain your problem better.

WP
 
Mariya Antony christopher
Ranch Hand
Posts: 49
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William P O'Sullivan wrote:Please explain your problem better.

WP


how to avoid memory leak in connection pool
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic