0

In jdbc request, I have query where table name should be passed as parameter

Select * from '${b1}'

Below in jdbc request I have Parameter values as tablename1 Variable names as b1

But after executing query I am getting an error - incorrect syntax near '${b1}'

Shruti Shinde
  • 43
  • 1
  • 6

2 Answers2

0
  1. You cannot use a table or database name in a prepared statement

  2. Even if it would be valid you should modify your SQL query to look like:

    select * from ?
    

So instead of using "Parameter values" in the JDBC Request sampler you should set the variable using i.e. User Defined Variables and amend your SQL query to look like:

select * from b1

and JMeter in the runtime will substitute ${b1} JMeter Variable placeholder with its respective value:

enter image description here

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

Instead of Select * from '${b1}' use Select * from ${b1} in your JDBC sample request.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 29 '23 at 12:30