Forum Discussion

lokithorshield's avatar
lokithorshield
Contributor
11 years ago
Solved

Passing values from Excel to SQL Jdbc connection for Where condition


Sorry if it s obvious but not sure how to describe this Technically
I have some values in excel
I need to pass this to a SQL in JDBC request - can you suggest if this is possible and how
in SQL i am going to read excel and pass a value to where condition

how to do this
example::
Lets say
1. Datas source Excel
2. Select xxx from aaa WHERE column-hard-coded = [Value from Excel]
3. Loop Datasource step and run query for different values

  • nmrao's avatar
    nmrao
    11 years ago
    Thats ok. Have you tried the suggestion above?

4 Replies

  • nmrao's avatar
    nmrao
    Icon for Champion Level 1 rankChampion Level 1

    Am sure there can be otherways, but this is one of the way.

    Read the value from data source.

    Then set it as test case level property value, may be in groovy step

    In the jdbc step, create a parameter say firstName and its value as ${#TestCase#FIRST_NAME} (assuming that FIRST_NAME was sent in groovy step)

    sql query looks like:

    select * from TABLE_NAME where TABLE_COLUMN = :firstName

    Loop thru data source.

    Hope this helps.

    • nmrao's avatar
      nmrao
      Icon for Champion Level 1 rankChampion Level 1
      It would have helped you and others if you try the reply rather than posting duplicates.
      • lokithorshield's avatar
        lokithorshield
        Contributor

        Thanks and sorry for the trouble. I actually did not realize i have posted twice- am not sure how I did that. Maybe i was also trying to post in stack overflow i must have copy pasted twice instead of once.

         

        Mahesh