Author: sebb
Date: Wed Jun 10 19:25:56 2009
New Revision: 783459
URL: http://svn.apache.org/viewvc?rev=783459&view=rev
Log:
JDBC Sampler should not close Prepared or Callable statements as these are
cached
Modified:
jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified:
jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java?rev=783459&r1=783458&r2=783459&view=diff
==============================================================================
---
jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
(original)
+++
jakarta/jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
Wed Jun 10 19:25:56 2009
@@ -163,8 +163,6 @@
res.sampleStart();
Connection conn = null;
Statement stmt = null;
- CallableStatement cstmt = null;
- PreparedStatement pstmt = null;
try {
@@ -187,7 +185,7 @@
close(rs);
}
} else if (CALLABLE.equals(_queryType)) {
- cstmt = getCallableStatement(conn);
+ CallableStatement cstmt = getCallableStatement(conn);
int out[]=setArguments(cstmt);
// A CallableStatement can return more than 1 ResultSets
// plus a number of update counts.
@@ -201,13 +199,13 @@
String results = updateCount + " updates";
res.setResponseData(results.getBytes(ENCODING));
} else if (PREPARED_SELECT.equals(_queryType)) {
- pstmt = getPreparedStatement(conn);
+ PreparedStatement pstmt = getPreparedStatement(conn);
setArguments(pstmt);
- pstmt.executeQuery(); // FindBugs: the statement is closed in
resultSetsToString()
+ pstmt.executeQuery();
String sb = resultSetsToString(pstmt,true,null);
res.setResponseData(sb.getBytes(ENCODING));
} else if (PREPARED_UPDATE.equals(_queryType)) {
- pstmt = getPreparedStatement(conn);
+ PreparedStatement pstmt = getPreparedStatement(conn);
setArguments(pstmt);
pstmt.executeUpdate();
String sb = resultSetsToString(pstmt,false,null);
@@ -246,8 +244,6 @@
} finally {
close(stmt);
close(conn);
- close(pstmt);
- close(cstmt);
}
// TODO: process warnings? Set Code and Message to success?
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=783459&r1=783458&r2=783459&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Wed Jun 10 19:25:56 2009
@@ -72,6 +72,7 @@
<h3>Other Samplers</h3>
<ul>
<li>Bug 47290 - Infinite loop on connection factory lookup (JMS)</li>
+<li>JDBC Sampler should not close Prepared or Callable statements as these are
cached</li>
</ul>
<h3>Controllers</h3>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]