简体   繁体   中英

Working With ODP.NET Asynchronously

Hay, My system needs to execute several major SQL`s (on Oracle DB) using the same connection (asynchronous).

What`s the best practice for this issue? 1. open single connection and execute every SQL statement on different thread (does it thread safe?) 2. create new connection and “open + close” it for every SQL statement

Thanks, Hec

We've been calling Oracle SQL statements on multiple threads, and this is probably best, if your DB can handle the load and won't be the bottleneck anyway. HOWEVER, I think you need to create the connection on the thread that will be issuing the SQL command. You can (and probably should) also use connection pooling so your connections will be reused, rather than being re-established (and Oracle seems to be fine with re-using these from one thread to another).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM