Hello i have been trying to replicate one the examples in the documentation (https://www.devart.com/dotconnect/unive ... onous.html, Synchronization objects part) but for some reason my code never stop at the WaitAll part. I was wondering what is the reason of this problem.
As an additional information WaitAll worked with OracleDataTable (It actually waited).
Here is a part from my code. Im sending a SQL Query that should take 2 min 10 sec
Im using dotConnect Universal 3.80.2402 Standart Edition
myConnections[0] = new UniConnection(conStr);
myCommands[0] = new UniCommand("SELECT DISTINCT * FROM (SELECT T2.* FROM (SELECT * FROM ASGPT_KUTHAY where rownum <4) T1, HAB_KAYIT T2, TENAY T3)", myConnections[0]);
myConnections[1] = new UniConnection(conStr);
myCommands[1] = new UniCommand("SELECT DISTINCT * FROM (SELECT T2.* FROM (SELECT * FROM ASGPT_KUTHAY where rownum <4) T1, HAB_KAYIT T2, TENAY T3)", myConnections[1]);
myConnections[0].Open();
myConnections[1].Open();
aResults[0] = myCommands[0].BeginExecuteReader();
aResults[1] = myCommands[1].BeginExecuteReader();
Console.WriteLine("Waiting for operations to complete...");
bool alldone = WaitHandle.WaitAll(new System.Threading.WaitHandle[] {
aResults[0].AsyncWaitHandle,
aResults[1].AsyncWaitHandle });
var myReader=myCommands[0].EndExecuteReader(aResults[0]);
var myReader1=myCommands[1].EndExecuteReader(aResults[1]);
WaitAll Problem
Re: WaitAll Problem
I suppose it is the time spent to fetch all the data returned by the SELECT query. Note that even in the synchronous mode, when we perform a SELECT command against the Oracle database (via dotConnect Universal or dotConnect for Oracle), the Execute method doesn't take any time, and returns a value immediately.
Code: Select all
UniCommand cmd = conn.CreateCommand();
cmd.CommandText = "SELECT * FROM VERY_BIG_TABLE";
UniDataReader reader = cmd.ExecuteReader(); // Will be execute immediately
while (reader.Read()) { /* … */ } // The time will be spent here
The Execute method can take much for non-Select queries only. For example:
Code: Select all
UniCommand cmd = conn.CreateCommand();
cmd.CommandText = "UPDATE BOOKS SET TAG = SLOW_FUNCTION(1)";
cmd.ExecuteNonQuery(); // Will take much time
Re: WaitAll Problem
In both cases, dotConnect Universal is a lot slower than the "native" providers for .NET. GB Whatsapp
Re: WaitAll Problem
The main feature of dotConnect Universal is access to multiple database servers using the same code, but dotConnect Universal doesn't support database-specific features for all databases.
So, with database specific providers you can reach better performance than dotConnect Universal.