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