Hi, "Select 1" is the default with current release of JMeter But I am agree with you that validation should be empty by default
I will modify it Antonio 2017-09-03 17:39 GMT+02:00 Philippe Mouawad <[email protected]>: > Thanks for the code. > I agree with Felix remark that validation should be empty by default. > > Regards > > On Sun, Sep 3, 2017 at 12:45 PM, Felix Schumacher < > [email protected]> wrote: > > > Am 03.09.2017 um 00:15 schrieb [email protected]: > > > >> Author: agomes > >> Date: Sat Sep 2 22:15:28 2017 > >> New Revision: 1807103 > >> > >> URL: http://svn.apache.org/viewvc?rev=1807103&view=rev > >> Log: > >> Add a list for "JDBC Connection Configuration" "Validation Query" > >> attribut. Screenshot later after I modified another attribute > >> > > I am not quite happy with this change. It is great to have a list of > > possible validation statements for different databases, but as modern > jdbc > > drivers should provide an isValid method, the default value for the > > validation query should be empty. > > > > More notes below. > > > > Modified: > >> jmeter/trunk/bin/jmeter.properties > >> jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/ > >> jdbc/config/DataSourceElementBeanInfo.java > >> jmeter/trunk/xdocs/changes.xml > >> jmeter/trunk/xdocs/usermanual/component_reference.xml > >> > >> Modified: jmeter/trunk/bin/jmeter.properties > >> URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.propert > >> ies?rev=1807103&r1=1807102&r2=1807103&view=diff > >> ============================================================ > >> ================== > >> --- jmeter/trunk/bin/jmeter.properties (original) > >> +++ jmeter/trunk/bin/jmeter.properties Sat Sep 2 22:15:28 2017 > >> @@ -714,6 +714,10 @@ wmlParser.types=text/vnd.wap.wml > >> # Max size of BLOBs and CLOBs to store in JDBC sampler. Result will be > >> cut off > >> #jdbcsampler.max_retain_result_size=65536 > >> +# Database validation query > >> +# based in https://stackoverflow.com/questions/10684244/dbcp- > validation > >> query-for-different-databases list > >> +jdbc.config.check.query=select 1 from INFORMATION_SCHEMA.SYSTEM_ > USERS|select > >> 1 from dual|select 1 from sysibm.sysdummy1|select 1|select 1 from > >> rdb$database > >> + > >> #----------------------------------------------------------- > >> ---------------- > >> # OS Process Sampler configuration > >> #----------------------------------------------------------- > >> ---------------- > >> > >> Modified: jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/ > >> jdbc/config/DataSourceElementBeanInfo.java > >> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jdbc/ > >> org/apache/jmeter/protocol/jdbc/config/DataSourceElementB > >> eanInfo.java?rev=1807103&r1=1807102&r2=1807103&view=diff > >> ============================================================ > >> ================== > >> --- jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/ > >> jdbc/config/DataSourceElementBeanInfo.java (original) > >> +++ jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/ > >> jdbc/config/DataSourceElementBeanInfo.java Sat Sep 2 22:15:28 2017 > >> @@ -30,6 +30,8 @@ import java.util.Set; > >> import org.apache.commons.lang3.StringUtils; > >> import org.apache.jmeter.testbeans.BeanInfoSupport; > >> import org.apache.jmeter.testbeans.gui.TypeEditor; > >> +import org.apache.jmeter.util.JMeterUtils; > >> +import org.apache.jorphan.util.JOrphanUtils; > >> import org.slf4j.Logger; > >> import org.slf4j.LoggerFactory; > >> @@ -86,9 +88,11 @@ public class DataSourceElementBeanInfo e > >> p = property("connectionAge"); > >> p.setValue(NOT_UNDEFINED, Boolean.TRUE); > >> p.setValue(DEFAULT, "5000"); > >> - p = property("checkQuery"); > >> + 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); > >> > > Don't name a local variable all upper case, as it would indicate a > > constant. This variable seems not to be used anywhere else and is > > initialized with a self describing method call, so I think it should be > > inlined. > > > > p = property("dbUrl"); > >> p.setValue(NOT_UNDEFINED, Boolean.TRUE); > >> p.setValue(DEFAULT, ""); > >> @@ -132,4 +136,13 @@ public class DataSourceElementBeanInfo e > >> } > >> return -1; > >> } > >> + > >> + /** > >> + * Get the check queris for the main databases > >> + * Based in https://stackoverflow.com/ques > >> tions/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$ > >> + } > >> } > >> > >> Modified: jmeter/trunk/xdocs/changes.xml > >> URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml? > >> rev=1807103&r1=1807102&r2=1807103&view=diff > >> ============================================================ > >> ================== > >> --- jmeter/trunk/xdocs/changes.xml [utf-8] (original) > >> +++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Sep 2 22:15:28 2017 > >> @@ -103,6 +103,7 @@ Incorporated feed back about unclear doc > >> <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 : Add a list for main databases > >> validation queries for "Validation Query" attribute</li> > >> </ul> > >> <h3>Controllers</h3> > >> > >> Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml > >> URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/c > >> omponent_reference.xml?rev=1807103&r1=1807102&r2=1807103&view=diff > >> ============================================================ > >> ================== > >> --- jmeter/trunk/xdocs/usermanual/component_reference.xml (original) > >> +++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sat Sep 2 > >> 22:15:28 2017 > >> @@ -4028,6 +4028,20 @@ instead. (see figures 12 and 13).</p> > >> <property name="Validation Query" required="No">A simple query > >> used to determine if the database is still responding. > >> 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_USER > >> S</li> > >> > > This markup should be a definition list <dl><dt>hsqldb</dt><dd>select > > ...</dd>...</dl> > > > >> + <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.co > >> m/questions/10684244/dbcp-validationquery-for-different-databases"> > >> https://stackoverflow.com/questions/10684244/dbcp- > >> validationquery-for-different-databases</a> and it can be > >> incorrect</note> > >> > > The text of the link could probably be changed to a descriptive type like > > "stackoverflow entry on different database validation queries". > > > > Regards, > > Felix > > > > <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> > >> > >> > >> > > > > > -- > Cordialement. > Philippe Mouawad. >
