You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Peter <pe...@gmail.com> on 2010/02/19 07:59:59 UTC

Accessing JDBC Connection Configuration in BeanShell Post-Processor

Hi!

In my testplan I am using the JDBC Connection Configuration Element. In a BeanShell Post-Processor I am doing database-checks using a beanshell-script.
How can I access in the script the JDBC Connection Configuration element from the testplan so that I do not have to manage the JDBC-config on multiple locations.

Thanks for any advice
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Accessing JDBC Connection Configuration in BeanShell Post-Processor

Posted by sebb <se...@gmail.com>.
On 02/03/2010, Peter <pe...@gmail.com> wrote:
> If I compare a JDBC-result (string) that contains e.g. the *-character, the comparison with a standard response assertion after a JDBC-Sampler does not work.

That's probably because you are using a Regex match rather than a String match.
Or because there are extraneous characters (e.g. spaces) which don't match.

>  I tried with a Beanshell-Assertion with String-comparison - there it worked. Additionally I tried for Debugging-purposes including the DB-query also in the Beanshell Script.
>
>  Ok, one could use the JDBC-Sampler and afterwards the Beanshell Assertion, you're right. But why does a normal Response Assertion not work in combination with String-Comparison in case of *-character in the DB-field?

Are you sure you are using a String comparison?
What are all the Response Assertion settings?

Try adding an Assertion Listener - this will show you the exact string
that is being looked for.

>  regards
>  Peter
>
>  Am 19.02.2010 um 08:17 schrieb Deepak Shetty:
>
>
>  > download the source code and check how the JDBCSampler does it.
>  >
>  > DataSourceElement.getConnection("datasourcename");
>  >
>  > (Not sure whether it will work)
>  > Why cant you use the JDBC sampler directly?
>  > regards
>  > deepak
>  >
>  > On Thu, Feb 18, 2010 at 10:59 PM, Peter <pe...@gmail.com> wrote:
>  >
>  >> Hi!
>  >>
>  >> In my testplan I am using the JDBC Connection Configuration Element. In a
>  >> BeanShell Post-Processor I am doing database-checks using a
>  >> beanshell-script.
>  >> How can I access in the script the JDBC Connection Configuration element
>  >> from the testplan so that I do not have to manage the JDBC-config on
>  >> multiple locations.
>  >>
>  >> Thanks for any advice
>  >> Peter
>  >> ---------------------------------------------------------------------
>  >> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  >> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>  >>
>  >>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Accessing JDBC Connection Configuration in BeanShell Post-Processor

Posted by Peter <pe...@gmail.com>.
If I compare a JDBC-result (string) that contains e.g. the *-character, the comparison with a standard response assertion after a JDBC-Sampler does not work.

I tried with a Beanshell-Assertion with String-comparison - there it worked. Additionally I tried for Debugging-purposes including the DB-query also in the Beanshell Script.

Ok, one could use the JDBC-Sampler and afterwards the Beanshell Assertion, you're right. But why does a normal Response Assertion not work in combination with String-Comparison in case of *-character in the DB-field?

regards
Peter

Am 19.02.2010 um 08:17 schrieb Deepak Shetty:

> download the source code and check how the JDBCSampler does it.
> 
> DataSourceElement.getConnection("datasourcename");
> 
> (Not sure whether it will work)
> Why cant you use the JDBC sampler directly?
> regards
> deepak
> 
> On Thu, Feb 18, 2010 at 10:59 PM, Peter <pe...@gmail.com> wrote:
> 
>> Hi!
>> 
>> In my testplan I am using the JDBC Connection Configuration Element. In a
>> BeanShell Post-Processor I am doing database-checks using a
>> beanshell-script.
>> How can I access in the script the JDBC Connection Configuration element
>> from the testplan so that I do not have to manage the JDBC-config on
>> multiple locations.
>> 
>> Thanks for any advice
>> Peter
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: Accessing JDBC Connection Configuration in BeanShell Post-Processor

Posted by Deepak Shetty <sh...@gmail.com>.
download the source code and check how the JDBCSampler does it.

DataSourceElement.getConnection("datasourcename");

(Not sure whether it will work)
Why cant you use the JDBC sampler directly?
regards
deepak

On Thu, Feb 18, 2010 at 10:59 PM, Peter <pe...@gmail.com> wrote:

> Hi!
>
> In my testplan I am using the JDBC Connection Configuration Element. In a
> BeanShell Post-Processor I am doing database-checks using a
> beanshell-script.
> How can I access in the script the JDBC Connection Configuration element
> from the testplan so that I do not have to manage the JDBC-config on
> multiple locations.
>
> Thanks for any advice
> Peter
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>