Add a list for "JDBC Connection Configuration" "Validation Query" attribut. Felix remarks implemented

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1807159 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Antonio Gomes Rodrigues 2017-09-03 18:40:36 +00:00
parent 9c8ed73903
commit ba65b7da06
3 changed files with 16 additions and 25 deletions

View File

@ -90,9 +90,8 @@ public class DataSourceElementBeanInfo extends BeanInfoSupport {
p.setValue(DEFAULT, "5000");
p = property("checkQuery", TypeEditor.ComboStringEditor);
p.setValue(NOT_UNDEFINED, Boolean.TRUE);
p.setValue(DEFAULT, "Select 1");
String[] CHECK_QUERY = getCheckQuery();
p.setValue(TAGS, CHECK_QUERY);
p.setValue(DEFAULT, "");
p.setValue(TAGS, JOrphanUtils.split(JMeterUtils.getPropDefault("jdbc.config.check.query", ""), "|"));
p = property("dbUrl");
p.setValue(NOT_UNDEFINED, Boolean.TRUE);
p.setValue(DEFAULT, "");
@ -136,13 +135,4 @@ public class DataSourceElementBeanInfo extends BeanInfoSupport {
}
return -1;
}
/**
* Get the check queris for the main databases
* Based in https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases
* @return a String[] with the list of check queries
*/
private String[] getCheckQuery() {
return JOrphanUtils.split(JMeterUtils.getPropDefault("jdbc.config.check.query", ""), "|"); //$NON-NLS-1$
}
}

View File

@ -103,6 +103,7 @@ Incorporated feed back about unclear documentation.
<ul>
<li><bug>61320</bug>Test Action : Set duration to <code>0</code> by default</li>
<li>JDBC Connection Configuration : Set Max Number of Connections to <code>0</code> by default</li>
<li>JDBC Connection Configuration : Set "Validation Query" to <code>empty</code> by default to use isValid method of JDBC driver</li>
<li>JDBC Connection Configuration : Add a list for main databases validation queries for "Validation Query" attribute</li>
</ul>

View File

@ -4029,19 +4029,19 @@ instead. (see figures 12 and 13).</p>
This defaults to the '<code>isValid()</code>' method of the jdbc driver, which is suitable for many databases.
However some may require a different query; for example Oracle something like '<code>SELECT 1 FROM DUAL</code>' could be used.
<p>The list of the validation queries can be configured with <code>jdbc.config.check.query</code> property and are by default:</p>
<ul>
<li>hsqldb - select 1 from INFORMATION_SCHEMA.SYSTEM_USERS</li>
<li>Oracle - select 1 from dual</li>
<li>DB2 - select 1 from sysibm.sysdummy1</li>
<li>mysql - select 1</li>
<li>microsoft SQL Server - select 1</li>
<li>postgresql - select 1</li>
<li>ingres - select 1</li>
<li>derby - values 1</li>
<li>H2 - select 1</li>
<li>Firebird - select 1 from rdb$database</li>
</ul>
<note>The list come from <a href="https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases">https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases</a> and it can be incorrect</note>
<dl>
<dt>hsqldb</dt><dd>select 1 from INFORMATION_SCHEMA.SYSTEM_USERS</dd>
<dt>Oracle</dt><dd>select 1 from dual</dd>
<dt>DB2</dt><dd>select 1 from sysibm.sysdummy1</dd>
<dt>mysql</dt><dd>select 1</dd>
<dt>microsoft SQL Server</dt><dd>select 1</dd>
<dt>postgresql</dt><dd>select 1</dd>
<dt>ingres</dt><dd>select 1</dd>
<dt>derby</dt><dd>values 1</dd>
<dt>H2</dt><dd>select 1</dd>
<dt>Firebird</dt><dd>select 1 from rdb$database</dd>
</dl>
<note>The list come from <a href="https://stackoverflow.com/questions/10684244/dbcp-validationquery-for-different-databases">stackoverflow entry on different database validation queries</a> and it can be incorrect</note>
<note>Note this validation query is used on pool creation to validate it even if "<code>Test While Idle</code>" suggests query would only be used on idle connections.
This is DBCP behaviour.</note>
</property>