java - If connection is closed by a Database, do I need to close it manually? -
this question has answer here:
- closing database connections in java 6 answers
i have connection pool. in getconnection()
method poll connection queue variable , check whether closed isclosed()
method. if closed set variable new connection drivermanager.getconnection(url, user, password)
method.
the question is: need close connection mannualy close()
method before rewriting varible ensure connection collected garbage collector?
it not needed (recommended)
.
if call close()
manually after connection has been closed, there no action performed on connection object.
Comments
Post a Comment