[英]Execution time of a sql query using jstl
I am using jstl to access a database table. 我正在使用jstl访问数据库表。 After a query has been executed, I need to find its execution time using jstl. 执行查询后,我需要使用jstl查找其执行时间。 I have attached the code I use: 我已经附上了我使用的代码:
<sql:update dataSource="${conn}" var="addresses">
${query}
</sql:update>
Is there a way to find it? 有没有办法找到它? I use ${addresses} to find the number of rows affected. 我使用$ {addresses}查找受影响的行数。
Thanks in advance 提前致谢
A simple solution would be: 一个简单的解决方案是:
<jsp:useBean id="beginUpdate" class="java.util.Date"/>
<sql:update dataSource="${conn}" var="addresses">
${query}
</sql:update>
<jsp:useBean id="endUpdate" class="java.util.Date"/>
<c:set var="updateDuration" value="${endUpdate.time - beginUpdate.time}"/>
But this really isn't the best way to accurately time the update. 但这确实不是准确定时更新时间的最佳方法。 However, if all you need is a general measure of how long it takes, then it's probably fine. 但是,如果您所需要的只是一般的时间量度,那么可能就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.