How to execute a data base correlation SQL query from the Responder Output - extension tool
I have a responder which executes a Data source -> data base correlation and I have chained the outputs to the responder and in one of the outputs I am setting the variable value that is used in the data base correlation, now in the next output I have to execute the data base correlation and fetch the database values.
Can anyone please suggest a solution. I am using the extension tool and trying to fetch the results as a list, but the query is not executing.
Answers
-
Hi,
The query can be executed automatically as part of "Data Source Correlation" for the responder. The "Data Source Correlation" tab in the responder has a number of options for how values can be extracted from the incoming request and then mapped into the query. Have you tried using "Data Source Correlations"?
0 -
Thank you for responding , I have tried data source correlations. Actually I need the query to be executed twice. One is in the responder mapping with the data source correlations and other is from the extension tool
0 -
Hi,
Ok so for that second execution to pass a value from the first extension tool to the second the context object has methods to put/get variables and I believe one of those can be used to create a value that the other context tool could get.
Eg.
context.put("myvariable", "some value")
Then in the second script
context.get("myvariable")
0 -
My extension tool should execute the data base correlation sql query
0 -
Hi,
Is all that the tool does is execute the query? If so then perhaps a DB Tool would be a better option since you wouldn't have to write all the SQL query code and would just need to setup the variable from the first extension tool.
0 -
The extension tool should fetch the query results using a variable with is set to have value in the tool just above it and update a new variable based on one of the column values and the new variable should be used in the responder literal
0 -
Hi,
In that case it might be easier to chain a tool to the output of the DB tool so that you don't have to write all the SQL code and then just look at the results and set the new variable based on the results.
0 -
But my databases server is different and it's not embedded server will DB tool still works for databases outside parasoft?
0 -
Hi,
What type of database are you connecting to? The DB tool supports many different database types based on using their JDBC drivers. From the screenshot, it appears that a "Database Correlation" data source is being used. Both the data source and the DB tool connect to SQL databases using JDBC so if the data source can connect to the database I would expect the DB tool can too.
Here is the documentation on the DB Tool
https://docs.parasoft.com/display/VIRT20222/DB0 -
Thank you DB tool it worked
0