Work with ODP.NET asynchronously

Hey, My system must execute several basic SQL queries (in Oracle DB) using the same connection (asynchronously).

What is the best practice for this problem? 1. open one connection and execute each SQL statement in a different thread (is it safe?) 2. create a new connection and "open + close" it for each SQL statement

Thanks Hec

+3
source share
1 answer

We call Oracle SQL statements for multiple threads, and this is probably best if your database can handle the load and not be a bottleneck anyway. HOWEVER, I think you need to create a connection in a thread that will issue an SQL command. You can (and probably should) also use the connection pool so that your connections are reused and not restored (and Oracle seems to be fine with reusing these threads from one thread to another).

+4
source

Source: https://habr.com/ru/post/1732744/


All Articles