Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Virtualize : Use Database as datasource and parameterize SQL query

We are using excel as a datasource and parameterized the responder response.
Since excel has limitations on rows , I wanted to use Database as a datasource.
But, if i use database , the query needs to be parameterized since account number i use is unique every time.
Based on the account number i need to get the rows from the database and have to parameterize the responder response using the columns that are retrieved in result set.
Can someone help on this please ?

Comments

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Hi,
    Would a db query tool work for your use case? You could chain the query tool to the incoming request and parameterize it the incoming account number. The results from the db query could be placed into a data bank for use in the responder.

  • bsaikrishna84
    bsaikrishna84 Posts: 66

    There is no DB Tool to use in responder. DB Tool works only when test case is created

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Hi,
    Did you check under all tools? When I tried adding a tool to the incoming request payload I had to find the DB Tool under the "All Tools" category. Or you can change the tools be sorted by category and then it is in the "Database" section. Maybe these screenshots will help.

  • bsaikrishna84
    bsaikrishna84 Posts: 66

    Oh yeah my bad I confused. Got it now.

    But how do i mention the variable in query.
    Do i need to add XML Databank to save the account number and then pass it to the query tool ?

    Or is there any other way to do it ?

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Hi,
    Yes chain an xml data bank before the DB Tool to extract the the variable and then reference the variable in the DB Tool. That is probably the easiest way to do it.

  • bsaikrishna84
    bsaikrishna84 Posts: 66

    Thanks william :)

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    You're welcome :smiley: