Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Does anyone know of any gotachs or problems when writing multithreaded Perl applications using the Oracle DBI? Each thread would have it's own connection to Oracle.

For the longest time I was told multithreading was not supported in Perl with Oracle.

like image 366
TM. Avatar asked Dec 16 '08 04:12

TM.


1 Answers

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.

like image 98
Jonathan Leffler Avatar answered Sep 18 '22 11:09

Jonathan Leffler