Submit and vote on feature ideas.

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.

Grabbing and storing Details from a SQL Server

Options
lukeliwanag
lukeliwanag Posts: 36

Hi Everyone,
I have a few different scenarios. They do not happen at the same time a request comes in.

  1. I just want to ask how can we grab some values from SQL server and use it to send to the xml response

  2. How do i generate a time stamp in this format "2015-12-18T19:44:18.103" and store it on the SQL Server.

Comments

  • jakubiak
    jakubiak Posts: 801 admin
    Options

    You can use a DB Tool to make a query to your SQL Server, and then attach an XML data bank to store the values into a Writable data source or into a variable that can be used in your responder.

    To generate the timestamp, you can use the Date Math tool from the Parasoft Marketplace. You can attach an Text Data Bank to it to store the value into a variable that can then be used in a query using the DB Tool.

  • lukeliwanag
    lukeliwanag Posts: 36
    Options

    @jakubiak thank you for your reply.

    How do i do this approach? once i execute this sample SQL query:
    "Select column1, column2 from mytable where column1=returns 1 row", what code should i write in order for me to:
    xmlDatabankVariable1 = column1. value
    etc?

  • jakubiak
    jakubiak Posts: 801 admin
    Options

    Right-click on the DB Tool that contains that SQL query and choose "Add Output". Then add an XML Data Bank to the "Results as XML" output. This will cause the result set that gets returned by the SQL query to be converted into an XML document. The XML Data Bank will then save the values you care about from the XML Document.