No need for various frameworks, just a model like JSP+Servlet+Dao
There are two main problems
1. In theory, Dao is responsible for the database, so all operations with the database (including closing connection, statement, resultsset) should be completed within dao. However, sometimes a certain operation in a servlet involves calling multiple daos, which means that the corresponding connection may be opened and closed multiple times, seriously affecting performance. So should we move it to a servlet?
2. When closing, if the connection is closed, the statement and resultsset will be closed automatically, so you don’t have to work hard to close them all.
淡淡烟草味2017-05-16 17:08:07
1 Database connection pool
2 No, statement and resultsset need to be released manually