I am using the connection pool in my application. My question is:
Explicitly, do you need to close the statement before closing the connection if you join the connection pool?
In a connection, the connection to the federated environment does not close (but returns back to the pool of free connections). I checked the functional specifications of jdbc 4.0. In paragraph 9.4.4, he clearly states that:
Closing Connection Objects An application calls the Connection.close method to indicate that it has finished using the connection. All Statement objects created from this Connection object will be closed when the close method is called on the object. When a connection is closed, any attempt to access any of its methods, with the exception of the close, isClosed, or isValid methods, will throw an SQLException.
Thus, jdbc specifications require closing the entire statement while closing the connection. Thus, is it applicable only to a jointed environment without a joint or is it also applied to a jointed joint medium?
For me, this does not matter in the case of a unified environment, because we are coding the interface ( java.sql.Connection and java.sql.Statement ). Therefore, we are not worried about the implementation, and the parent class ( java.sql.Connection ) does not have any information about the child / impementation class (Vendor implementation class).
source share