Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

What does conn.close() do when using datapool?

Thread view: 
JTL.zheng - 10 Nov 2007 03:34 GMT
I am using tomcat's datapool + mysql.

when I call conn.close() after I finish my job.
what does it do exactly?

it will get the connection back to tomcat's datapool so the next user
can use it?
or destory the connection and next time tomcat will build a new
connection for the next user?
JTL.zheng - 10 Nov 2007 03:56 GMT
and should I close other resource(rs and stmt)?
like:
        rs.close();
        stmt.close();
        conn.close();

or just close conn,and it will close the other two?
Chris ( Val ) - 10 Nov 2007 04:57 GMT
> and should I close other resource(rs and stmt)?
> like:
[quoted text clipped - 3 lines]
>
> or just close conn,and it will close the other two?

You should close them explicitly, and not depend on
different driver implementations.

--
Chris
Chris ( Val ) - 10 Nov 2007 04:51 GMT
> I am using tomcat's datapool + mysql.
>
[quoted text clipped - 5 lines]
> or destory the connection and next time tomcat will build a new
> connection for the next user?

http://en.wikipedia.org/wiki/Connection_pool

--
Chris
JTL.zheng - 11 Nov 2007 01:37 GMT
Thank you very much.
so I should close the connection however it will not be destoried but
be returned to tomcat.
Chris ( Val ) - 11 Nov 2007 13:15 GMT
> Thank you very much.
> so I should close the connection however it will not be destoried but
> be returned to tomcat.

Yes, you close the connection as normal.

When you close the connection, it returned back to
the connection pool for other applications to acquire
it, if need be.

--
Chris
JTL.zheng - 11 Nov 2007 15:06 GMT
Thank you very much
:-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.