How to get multiple datasets after calling db stored procedure in Mule - db2

A Mule application is calling a stored procedure like this: call sp("email","ispresent","id"). This procedure returns two data sets; one dataset for user details and another for college details. Below I'm attaching an example response which we need to get after calling the procedure.
{
"userdetails": {
"emailId":""abc#gmail.com",
"useris":"20"
"ispresent":0,
"collegedetails":{
"collegeName":"VV",
"collegeid":"12"
}
}

Related

How to get dynamically all json files table data in a table(sql server data warehouse) using Azure Data Factory(Load from ADF to DWH)

I have to get all json files data into a table from azure data factory to sql server data warehouse.i'm able to load the data into a table with static values (by giving column names in the dataset) but generating in dynamic i'm unable to get that using azure data factory.Can some help on this solution to get dynamically in azure data factory?
Many thanks in Advance.
json file data as follows:
{
"TABLE": "TEST_M1",
"DATA": [{
"DFG": "123456",
"ADF": "SFSDF"
}, {
"DFG": "ABADHDD",
"ADF": "GHB"
}
}
same as follows for different TABLE names(TEST_M2.....)
You could invoke a stored procedure script in sql serer sink when doing copy.
Stored procedure script defines the logic about how to generate dynamic value based on source json data. See an example: https://learn.microsoft.com/en-us/azure/data-factory/connector-sql-server#invoking-stored-procedure-for-sql-sink

How to save Data factory stored procedure output

Whenever I execute a stored procedure in the ADFv2, it gives me an output as
{
"effectiveIntegrationRuntime": "DefaultIntegrationRuntime (Australia Southeast)",
"executionDuration": 34
}
even though I have set 2 variables as output in the procedure. Is there any way to map the output of the stored procedure in the ADFv2? Till now I can map the output of all the other activities but not of Stored procedures.
You could use a lookup activity to get the result.
Please reference this post. https://social.msdn.microsoft.com/Forums/azure/en-US/82e84ec4-fc40-4bd3-b6d5-b742f3cd1a33/adf-v2-how-to-check-if-stored-procedure-output-is-empty?forum=AzureDataFactory
Update by Gagan:
Instead of getting the output of SP (which is not possible in ADFv2 right now), I stored the output in the table and then apply lookup-foreach to the table to get the value.
Stored procedure call in Data factory (v2) does not capture the result data set. So you cannot use the stored procedure activity to get the result data set and refer it in next activities.
Workaround is to use lookup activity to call exact same stored procedure as lookup will get you the result data set from stored procedure. Replace your Stored procedure activity with lookup and it will work.

Calling stored procedure which does not return a list using Entity Framework

I understand if my stored procedure returns a data set I can do this
_context.Database.SqlQuery<Product>(query, parameters).ToList<Product>()
But, If I have a stored procedure which does not return anything, how can I call that from entity framework? What goes in place of the "?" below?
_context.Database.SqlQuery<?>(query, parameters).ToList<?>()
Have you mapped the stored procedure to a function in the model browser yet?
If you go to your edmx file and right click, you can add->function import and then specify the details of the stored procedure you want to import.
This will map it to a function, you can then efffectively call your stored procedure using
_context.(NameYouGaveFunction)

SQL Anywhere, Entity Framework 4 and Transactions

I have a process in my program that uses an Entity Framework 4 EDM. The entity context object contains function imports for calling stored procedures.
The process receives a batch of data from a remote server. The batch can consist of data for any of our tables / data types (each data type is stored in its own table). The batch can also contain data for the same row multiple times. It has to handle this as a single insert (for the first occurance) and one or more updates (for each subsequent occurance). The stored procedures therefore implement an upsert operation using the INSERT ... ON EXISTING UPDATE command.
Our code basically determines which stored procedure to call and then calls it using the entity context object's method for that stored procedure. Then entire batch has to be done in a single transaction, so we call context.Connection.BeginTransaction() at the beginning of the batch.
There is one data type that has millions of rows. We need to load that data as quickly as possible. I'm implementing logic to import that data type using the SABulkCopy class. This also needs to be a part of the single transaction already started. The issue is that I need to pass an SATransaction to the SABulkCopy class's constructor (there is no way to set it it using properties) and I don't have an SATransaction. context.Connection.BeginTransaction() returns a DBTransaction. I tried to cast this into an SATransaction without success.
What's the right way to get the SABulkCopy object to join the transaction?
We gave up on the SABulkCopy class. It turns out that it doesn't do a bulk load. It creates an SACommand object that executes an INSERT statement and inserts the rows one at a time. And it does it inefficiently, to boot.
I still needed to get at the SATransaction associated with the DBTransaction returned by context.Connection.BeginTransaction(). I was given some reflection code that does this in response to another question I posted about this:
SATransaction saTransaction = (SATransaction) dbTransaction.GetType()
.InvokeMember( "StoreTransaction",
BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.InvokeMethod |
BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.NonPublic,
null, dbTransaction, new object[ 0 ] );
The program does what it needs to do. It's unfortunate, though, that Microsoft didn't make the StoreTransaction property of the EntityTransaction class public.

Retrieving output values from stored procedure - GetColumn

I need to invoke a stored procedure and it has no OUT parameters instead it writes to the buffer manager by calling putcolumn.How can I retrieve the data set using put column from a JAVA application.
My stored procedure is an oracle on.Can someone provide your inputs to sort my issue?