CheckConnection and multithreading questions

Marco,

Just double checking some issues with you.
1) Since I saw no statement to indicate otherwise, I assume that the overhead for doing a check connection before an operation is minimal. Is it still better to just attempt an operation without prechecks and then, only if it fails, reconnect if needed and attempt the operation again?

2) I assume that there is no direct relationship between a session and a thread as long as synchronization prevents threads attempting overlapping OCI calls in a given session.
Thus the following actions if serial would be ok (even if bizarre):
Thread A opens cursor 1 an fetches 10 rows into Dataset 1.
Thread B opens cursor 2 an fetches 10 rows into Dataset 2.
Thread C fetches 10 more rows from cursor1 into Dataset 1.
Thread A fetches 10 more rows from cursor2 into Dataset 2.
Thread B starts a transaction by executing a stored proc
Thread C ends the transaction by executing a commit
Thread C closes dataset2 and thus Cursor2
Thread C closes dataset1 and thus Cursor1

I assume that only one transaction could be active at a time, but I
 
1) The CheckConnection function performs a simple "select 'x' from dual" and analyzes the result to verify that the session is still alive. The overhead should be minimal.

2) Only one transaction can be active at a time, and will not be affected by select statements since they do not affect the transaction state. There should not be a problem.
 
Back
Top