I use ADO.Net to connect to some Sql Server and Oracle databases, and I want to run some of my queries at the same time.
I use classes from the SqlClient namespace for Sql Server and ODP.Net for Oracle. For the Sql server, I added the MARS parameter to the connection string and call the asynchronous APIs on SqlCommand. ODP.Net does not provide an asynchronous API, so I have to give separate threads to my parallel Oracle commands.
My question is: how do I handle communication objects? Should I create one DbConnection for each database instance and execute the commands asynchronously against one connection or provide a separate connection object for each of my parallel commands? Does a shared connection object create a conflicting point to execute multiple commands at the same time?
I will write some comparative tests, but would like to hear from someone who has experience working with asynchronous database commands. Thank you in advance!
source
share