I do not believe accessing a connection is thread safe (for any database). Each thread should have it’s own connection. Connection Pooling Tutorial · Oracle.jl is normally the way you handle this. You create a pool size of say 20 connections and each thread takes a connection when needed and returns it when done. If there are no available connections then the thread waits for one to be returned.
The key is to have each thread use the connection for the minimum amount of time, so query for the information, return the connection, THEN process the data.
The size of the connection pool really depends on your queries and database server (so there is no single magic number for all). Too many and you are wasting server resources or worse causing your db server to thrash. Too few and you are not fully utilizing your database.
Oracle.jl calls C code. If the C code is not thread safe, then corruption is likely to occur. This can overwrite pointers, then accessing corrupt pointers often results in a process crash.
The Oracle.jl code is really just a bridge into the C library so I suspect it’s the C library that is causing memory corruption or something. So i don’t think there is much that can be done in Julia. The author of Oracle.jl could provide locking around the execute calls however that would be an overhead they might not want to incur.