You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by o haya <oh...@yahoo.com.INVALID> on 2016/12/07 02:18:32 UTC

JDBC request with table name as a variable?

Hi,

I want to implement at test plan where I am executing "select" statements but against different table names, where the set of table names is in a CSV file.

Say I have a CSV file:

table1
table2
table3

and I run the test plan, then this causes the following:

select count(*) from table1

then the next iteration in the loop does:

select count(*) from table2

then the next iteration in the loop does:

select count(*) from table3

then the next iteration in the loop does:

select count(*) from table1

etc.

If the CSV file has:

table10
table11
table12
table13 

Then I run the test plan it will do:

select count(*) from table10

then the next iteration in the loop does:

select count(*) from table11

then the next iteration in the loop does:

select count(*) from table12

then the next iteration in the loop does:

select count(*) from table13

then the next iteration in the loop does:

select count(*) from table10

etc.

I tried using 

select count(*) from ${tablename}

but that appears to become:

select count(*) from "table1"

rather than:

select count(*) from table1

Is there a way to do what I'm trying to do with Jmeter?

Thanks,
Jim



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


Re: JDBC request with table name as a variable?

Posted by Riji K <kr...@gmail.com>.
Hi,

When a value is passed from CSV it is considered as string. After getting
the value from CSV write a beanshell and convert it to a table name. Or use
a beanshell program to retrieve the table count values.

Thanks,
Riji

On Dec 7, 2016 07:48, "o haya" <oh...@yahoo.com.invalid> wrote:

> Hi,
>
> I want to implement at test plan where I am executing "select" statements
> but against different table names, where the set of table names is in a CSV
> file.
>
> Say I have a CSV file:
>
> table1
> table2
> table3
>
> and I run the test plan, then this causes the following:
>
> select count(*) from table1
>
> then the next iteration in the loop does:
>
> select count(*) from table2
>
> then the next iteration in the loop does:
>
> select count(*) from table3
>
> then the next iteration in the loop does:
>
> select count(*) from table1
>
> etc.
>
> If the CSV file has:
>
> table10
> table11
> table12
> table13
>
> Then I run the test plan it will do:
>
> select count(*) from table10
>
> then the next iteration in the loop does:
>
> select count(*) from table11
>
> then the next iteration in the loop does:
>
> select count(*) from table12
>
> then the next iteration in the loop does:
>
> select count(*) from table13
>
> then the next iteration in the loop does:
>
> select count(*) from table10
>
> etc.
>
> I tried using
>
> select count(*) from ${tablename}
>
> but that appears to become:
>
> select count(*) from "table1"
>
> rather than:
>
> select count(*) from table1
>
> Is there a way to do what I'm trying to do with Jmeter?
>
> Thanks,
> Jim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: JDBC request with table name as a variable?

Posted by sebb <se...@gmail.com>.
On 7 December 2016 at 02:18, o haya <oh...@yahoo.com.invalid> wrote:
> Hi,
>
> I want to implement at test plan where I am executing "select" statements but against different table names, where the set of table names is in a CSV file.
>
> Say I have a CSV file:
>
> table1
> table2
> table3
>
> and I run the test plan, then this causes the following:
>
> select count(*) from table1
>
> then the next iteration in the loop does:
>
> select count(*) from table2
>
> then the next iteration in the loop does:
>
> select count(*) from table3
>
> then the next iteration in the loop does:
>
> select count(*) from table1
>
> etc.
>
> If the CSV file has:
>
> table10
> table11
> table12
> table13
>
> Then I run the test plan it will do:
>
> select count(*) from table10
>
> then the next iteration in the loop does:
>
> select count(*) from table11
>
> then the next iteration in the loop does:
>
> select count(*) from table12
>
> then the next iteration in the loop does:
>
> select count(*) from table13
>
> then the next iteration in the loop does:
>
> select count(*) from table10
>
> etc.
>
> I tried using
>
> select count(*) from ${tablename}
>
> but that appears to become:
>
> select count(*) from "table1"
>
> rather than:
>
> select count(*) from table1
>
> Is there a way to do what I'm trying to do with Jmeter?

That should work.
Are you sure that quotes are added to the table name in the query?
Check that they are not present in the input by using the Debug
element to display the value of the tablename variable.

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

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