第一个问题的解决方法:1 修改TOMCAT_HOME/conf/server.xml里面对应的<context ... reloadable="true" >2 或在浏览器里面输入http://YOUR_HOST/manager/reload?path=YOUR_CONTEXT第二个问题的解决方法:
1 可能与数据库和操作系统有关系. 记得曾经有个项目,Tomcat在Win2K上比较慢,换到WinXP上就比较快了.用的是同一个mssql数据库.建议用性能诊断工具察看一下第三个问题的答案:
1 如果用户数不多,这样关闭是不会出现问题的.如果用户量很大,建议使用数据库连接池, Apache的DBCP还可以. 毕竟Connection资源申请和释放的代价都是十分高昂的.
1 可能与数据库和操作系统有关系. 记得曾经有个项目,Tomcat在Win2K上比较慢,换到WinXP上就比较快了.用的是同一个mssql数据库.建议用性能诊断工具察看一下第三个问题的答案:
1 如果用户数不多,这样关闭是不会出现问题的.如果用户量很大,建议使用数据库连接池, Apache的DBCP还可以. 毕竟Connection资源申请和释放的代价都是十分高昂的.
---------------------------------------------------
Connection conn = null;
Statement stmt = null; // Or PreparedStatement if needed
ResultSet rs = null;
try {
conn = ... get connection from connection pool ...
stmt = conn.createStatement("select ...");
rs = stmt.executeQuery();
... iterate through the result set ...
rs.close();
rs = null;
stmt.close();
stmt = null;
conn.close(); // Return to connection pool
conn = null; // Make sure we don't close it twice
} catch (SQLException e) {
... deal with errors ...
} finally {
// Always make sure result sets and statements are closed,
// and the connection is returned to the pool
if (rs != null) {
try { rs.close(); } catch (SQLException e) { ; }
rs = null;
}
if (stmt != null) {
try { stmt.close(); } catch (SQLException e) { ; }
stmt = null;
}
if (conn != null) {
try { conn.close(); } catch (SQLException e) { ; }
conn = null;
}
}
但这一功能会加重服务器得运行负荷,建议在发布阶段改为false