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 +开发者_如何学JAVA 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).
精彩评论