cancel
Showing results for 
Search instead for 
Did you mean: 

Error java.lang.IllegalArgumentException: Parameter 'name' was not found in the SQL Query

SOLVED
Woutje
New Contributor

Error java.lang.IllegalArgumentException: Parameter 'name' was not found in the SQL Query

I'm trying to write a query using predefined properties on TestCase level, but I keep getting an error when trying to execute the query. What is wrong with my query?

 

A7382389-2DA7-42DA-A6C4-D1228684686F.jpeg

1 ACCEPTED SOLUTION

Accepted Solutions
richie
Community Hero

Re: Error java.lang.IllegalArgumentException: Parameter 'name' was not found in the SQL Query

Hey @Woutje,

I dont typically use the properties from within a jdbc teststep, i normally use properties from a separate object so this is an educated guess but i noticed several things.

Is the sql you want to execute actually a stored proc? If not, then uncheck the relevant tickbox

Next with the values in your query it would appear everything is numeric cos you havent used quote marks surrounding you values. You need to check the datatypes of each of the table attributes you want e.g. your name attribute is likely gonna be a string/text, so the relevant value should be surrounded by quote...e.g. '${jdbcRequest#name}'

Finally, however if you use properties from within a jdbc step the syntax is a little different (if you use properties from another object your syntax is fine, but not if the props are held in the jdbc step). Rather than use the prop expansion syntax like ${stepname#propname}, you use the propertyname with a colon suffix, e.g. :name

So! Id change your query to look something like the following:

Insert into employeeinfo (name, id, location, age, gender) values (':name', ':id', ':location', :age, ':gender);

Note im guessing the age datatype is numeric.

Make the changes and report back on progress and we'll sort. You should be good to go though!

Ta

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

View solution in original post

2 REPLIES 2
richie
Community Hero

Re: Error java.lang.IllegalArgumentException: Parameter 'name' was not found in the SQL Query

Hey @Woutje,

I dont typically use the properties from within a jdbc teststep, i normally use properties from a separate object so this is an educated guess but i noticed several things.

Is the sql you want to execute actually a stored proc? If not, then uncheck the relevant tickbox

Next with the values in your query it would appear everything is numeric cos you havent used quote marks surrounding you values. You need to check the datatypes of each of the table attributes you want e.g. your name attribute is likely gonna be a string/text, so the relevant value should be surrounded by quote...e.g. '${jdbcRequest#name}'

Finally, however if you use properties from within a jdbc step the syntax is a little different (if you use properties from another object your syntax is fine, but not if the props are held in the jdbc step). Rather than use the prop expansion syntax like ${stepname#propname}, you use the propertyname with a colon suffix, e.g. :name

So! Id change your query to look something like the following:

Insert into employeeinfo (name, id, location, age, gender) values (':name', ':id', ':location', :age, ':gender);

Note im guessing the age datatype is numeric.

Make the changes and report back on progress and we'll sort. You should be good to go though!

Ta

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta

View solution in original post

Woutje
New Contributor

Re: Error java.lang.IllegalArgumentException: Parameter 'name' was not found in the SQL Query

Hi Rich,

 

Thanks for your feedback. In the meantime I had also discovered this. Id and age are indeed numbers. The rest are strings.

 

KR

Woutje

 

 

New Here?
Join us and watch the welcome video:
Top Kudoed Authors