Can I use multithreading with Perl's DBI and Oracle? Can I use multithreading with Perl's DBI and Oracle? database database

Can I use multithreading with Perl's DBI and Oracle?


The Perl DBI enforces single-threading through its interior, so the drivers will only be active on one session ($dbh) at a time. Regardless of how many CPUs you have. So, multi-threading is not supported (because everything inside DBI is single-threaded), but it is safe to use DBI (and hence DBD::Oracle) in a multi-threaded application.


Well, the DBI documentation says not to use a threaded Perl, and points to a Perlmonks post that explains that. The documentation telling you not to do it is a pretty good reason.

However, I've seen it work just fine on some platforms but fail miserably on others. It's certainly not portable even if you do get it to work.


I've used multi threading in Perl for benchmarking an Oracle db and I had to create a database handler for every thread.