database pool means that the conncetion can be used by other user.
so when I finish the job, should I call
conn.close();
after it as the old way?
Am Thu, 08 Nov 2007 06:09:06 -0800 schrieb JTL.zheng:
> database pool means that the conncetion can be used by other user.
> so when I finish the job, should I call
> conn.close();
> after it as the old way?
Yes. However, you should refer to the documentation of
your pool library to be sure. E. g. it could be like this:
PooledConnection conn = Pool.getConnection();
...
conn.close()
where the implementation of PooledConnection#close()
may choose to return the connection to the pool.
-- Sebastian
Wojtek - 08 Nov 2007 15:58 GMT
Sebastian Millies wrote :
> Am Thu, 08 Nov 2007 06:09:06 -0800 schrieb JTL.zheng:
>
[quoted text clipped - 10 lines]
> where the implementation of PooledConnection#close()
> may choose to return the connection to the pool.
As noted above, you should alwasy explicitly close connections (and
result sets, and cursors, and statements, and ...).
Some pool managers (proxool for example) will automatically clean up
connection resources such as statements and result sets.
And proxool will also close connections after a certain number of
seconds.

Signature
Wojtek :-)
JTL.zheng - 11 Nov 2007 01:38 GMT
Thank you very much.
so I should close the connection however it will not be destoried but
be returned to tomcat.
Esmond Pitt - 11 Nov 2007 23:06 GMT
> Thank you very much.
> so I should close the connection however it will not be destoried but
> be returned to tomcat.
Not to Tomcat: returned to the JDBC driver's connection pool.
JTL.zheng - 12 Nov 2007 04:45 GMT
is it not the web container like tomcat or weblogic implement the
database pool but the database driver itself like mysql's java
connector?
Arne Vajhøj - 12 Nov 2007 04:49 GMT
> is it not the web container like tomcat or weblogic implement the
> database pool but the database driver itself like mysql's java
> connector?
Usually it is the container that implements the connection pool.
Arne
JTL.zheng - 14 Nov 2007 03:31 GMT