• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

JDBC connection pool

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a question on JDBC connection pools. I have created a connection pool in WebLogic Server and using it from my application. As we know, in case of hand-coded connection pools we release the connection to the pool, once it is used. How do we release a connection in case of server specific connection pool. I am getting the connection object from a datasource related to the connection pool that I have created in WLS. I do not know how to release it.
Shubhashis
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I work with weblogic server. Here is how I get a connection:
<code>
DataSource ds = (DataSource) ctx.lookup (dsJNDIName);
conn = ds.getConnection();
</code>
and when I am done with it I just close the connection. The welogic server actually releases it.
<code>conn.close();</code>
Basically leave it to the app server to manage the pool.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use Oracle, you can close the resultset as well.
resultSet.getStatement().close();
In doing so, you should be able to prevent any unclosed cursor.

Originally posted by Shubhashis Dasgupta:
Hi all,
I have a question on JDBC connection pools. I have created a connection pool in WebLogic Server and using it from my application. As we know, in case of hand-coded connection pools we release the connection to the pool, once it is used. How do we release a connection in case of server specific connection pool. I am getting the connection object from a datasource related to the connection pool that I have created in WLS. I do not know how to release it.
Shubhashis


 
Shubhashis Dasgupta
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thax tim, subramaniam.
Actually I was not very sure that closing a connection really leads to releasing it to the pool by app. server itself.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the weblogic documentation proof of what happens when you close a connection.
http://e-docs.bea.com/wls/docs60////jdbc/performance.html#1023983
it basically says:
"When a client closes a connection from a connection pool, the connection is returned to the pool and becomes available for other clients; the connection itself is not closed"
 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to know in what ways is a single connection different from a connection pool ?
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic