You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Paul-the-hat <we...@lewin-planet.net> on 2008/12/10 10:44:48 UTC

JDBC Request: Select returning values to variables

I'm facing the problem that I need to dynamically use data read via a JDBC
Request during the subsequent test strategy.

Around the beginning of November I read that the next JMeter release would
include the functionality to extract data from a SELECT statement into user
variables. Does anyone know when that release is likely to become available?

Cheers
Paul
-- 
View this message in context: http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p20931986.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: JDBC Request: Select returning values to variables

Posted by EvilPeanut <Cl...@eai.co.za>.
Thank you for replying. I will begin testing it :-)



yaroslav1 wrote:
> 
> the idea is like this:
> 
> 1. do a JDBC request like:
> SELECT ("field=" + field) as field FROM table;
> 
> As result in ResponseData  you will have: 
> 
> field=<data>
> 
> 2. use "Post Beanshell" sample in the JDBC to extract data by template:
> "field=(.+)"
> 
> If you have more then 1 field - then use for all fields the extract
> template as "field1=(.+\r)", 
> "field2=(.+\r)", and etc
> \r - means that the data are "tab" delimited. 
> For the last field use a template like - "fieldN=(.+)"
> 
> I think it will help you.
> Yaroslav
> 
> 

-- 
View this message in context: http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p21540449.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: JDBC Request: Select returning values to variables

Posted by sebb <se...@gmail.com>.
On 18/01/2009, yaroslav1 <sl...@yahoo.com> wrote:
>
>  the idea is like this:
>
>  1. do a JDBC request like:
>  SELECT ("field=" + field) as field FROM table;
>
>  As result in ResponseData  you will have:
>
>  field=<data>
>
>  2. use "Post Beanshell" sample in the JDBC to extract data by template:
>  "field=(.+)"
>
>  If you have more then 1 field - then use for all fields the extract template
>  as "field1=(.+\r)",
>  "field2=(.+\r)", and etc
>  \r - means that the data are "tab" delimited.

\r means carriage return, not tab, which is \t

>  For the last field use a template like - "fieldN=(.+)"
>
>  I think it will help you.
>  Yaroslav
>
>
>
>
>  EvilPeanut wrote:
>  >
>  > Hi yaroslav1
>  >
>  > I would be very interested in more detail. Do you by chance have an
>  > example of this? I'm trying to get this working within the next few hours,
>  > so I'm pretty desperate to get this done ASAP. Sorry if it seems like I'm
>  > just grabbing at straws.
>  >
>  > Thanks in Advance
>  >
>  >
>  > yaroslav1 wrote:
>  >>
>  >> Hi Paul-the-hat,
>  >>
>  >> You can use some tricky technique to get your goal. You need to update
>  >> SELECT statement to use your defined column names with printing each of
>  >> them in new line. Once you reach this result you can just simply use
>  >> post-regular-expression-extractor to create variables for them.
>  >> If you need more detail, let me know.
>  >>
>  >> Happy New Years everybody!
>  >>
>  >>
>  >>
>  >
>  >
>
>
> --
>  View this message in context: http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p21524862.html
>
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  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: JDBC Request: Select returning values to variables

Posted by yaroslav1 <sl...@yahoo.com>.
the idea is like this:

1. do a JDBC request like:
SELECT ("field=" + field) as field FROM table;

As result in ResponseData  you will have: 

field=<data>

2. use "Post Beanshell" sample in the JDBC to extract data by template:
"field=(.+)"

If you have more then 1 field - then use for all fields the extract template
as "field1=(.+\r)", 
"field2=(.+\r)", and etc
\r - means that the data are "tab" delimited. 
For the last field use a template like - "fieldN=(.+)"

I think it will help you.
Yaroslav



EvilPeanut wrote:
> 
> Hi yaroslav1
> 
> I would be very interested in more detail. Do you by chance have an
> example of this? I'm trying to get this working within the next few hours,
> so I'm pretty desperate to get this done ASAP. Sorry if it seems like I'm
> just grabbing at straws.
> 
> Thanks in Advance
> 
> 
> yaroslav1 wrote:
>> 
>> Hi Paul-the-hat,
>> 
>> You can use some tricky technique to get your goal. You need to update
>> SELECT statement to use your defined column names with printing each of
>> them in new line. Once you reach this result you can just simply use
>> post-regular-expression-extractor to create variables for them.
>> If you need more detail, let me know.
>> 
>> Happy New Years everybody!
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p21524862.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: JDBC Request: Select returning values to variables

Posted by EvilPeanut <Cl...@eai.co.za>.
Hi yaroslav1

I would be very interested in more detail. Do you by chance have an example
of this? I'm trying to get this working within the next few hours, so I'm
pretty desperate to get this done ASAP. Sorry if it seems like I'm just
grabbing at straws.

Thanks in Advance


yaroslav1 wrote:
> 
> Hi Paul-the-hat,
> 
> You can use some tricky technique to get your goal. You need to update
> SELECT statement to use your defined column names with printing each of
> them in new line. Once you reach this result you can just simply use
> post-regular-expression-extractor to create variables for them.
> If you need more detail, let me know.
> 
> Happy New Years everybody!
> 
> 
> 
> sebb-2-2 wrote:
>> 
>> On 10/12/2008, Paul-the-hat <we...@lewin-planet.net> wrote:
>>>
>>>  I'm facing the problem that I need to dynamically use data read via a
>>> JDBC
>>>  Request during the subsequent test strategy.
>>>
>>>  Around the beginning of November I read that the next JMeter release
>>> would
>>>  include the functionality to extract data from a SELECT statement into
>>> user
>>>  variables. Does anyone know when that release is likely to become
>>> available?
>>>
>> 
>> Hopefully there will be a JMeter release early next year.
>> 
>> The JDBC variable code is in the nightly builds (linked from the
>> website) if you want to give it a try.
>> 
>>>  Cheers
>>>  Paul
>>>
>>> --
>>>  View this message in context:
>>> http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p20931986.html
>>>  Sent from the JMeter - User mailing list archive at Nabble.com.
>>>
>>>
>>>  ---------------------------------------------------------------------
>>>  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
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p21497491.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: JDBC Request: Select returning values to variables

Posted by yaroslav1 <sl...@yahoo.com>.
Hi Paul-the-hat,

You can use some tricky technique to get your goal. You need to update
SELECT statement to use your defined column names with printing each of them
in new line. Once you reach this result you can just simply use
post-regular-expression-extractor to create variables for them.
If you need more detail, let me know.

Happy New Years everybody!



sebb-2-2 wrote:
> 
> On 10/12/2008, Paul-the-hat <we...@lewin-planet.net> wrote:
>>
>>  I'm facing the problem that I need to dynamically use data read via a
>> JDBC
>>  Request during the subsequent test strategy.
>>
>>  Around the beginning of November I read that the next JMeter release
>> would
>>  include the functionality to extract data from a SELECT statement into
>> user
>>  variables. Does anyone know when that release is likely to become
>> available?
>>
> 
> Hopefully there will be a JMeter release early next year.
> 
> The JDBC variable code is in the nightly builds (linked from the
> website) if you want to give it a try.
> 
>>  Cheers
>>  Paul
>>
>> --
>>  View this message in context:
>> http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p20931986.html
>>  Sent from the JMeter - User mailing list archive at Nabble.com.
>>
>>
>>  ---------------------------------------------------------------------
>>  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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p21237661.html
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: JDBC Request: Select returning values to variables

Posted by sebb <se...@gmail.com>.
On 10/12/2008, Paul-the-hat <we...@lewin-planet.net> wrote:
>
>  I'm facing the problem that I need to dynamically use data read via a JDBC
>  Request during the subsequent test strategy.
>
>  Around the beginning of November I read that the next JMeter release would
>  include the functionality to extract data from a SELECT statement into user
>  variables. Does anyone know when that release is likely to become available?
>

Hopefully there will be a JMeter release early next year.

The JDBC variable code is in the nightly builds (linked from the
website) if you want to give it a try.

>  Cheers
>  Paul
>
> --
>  View this message in context: http://www.nabble.com/JDBC-Request%3A-Select-returning-values-to-variables-tp20931986p20931986.html
>  Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  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