我可以使用Perl的DBI和Oracle多线程吗? [英] Can I use multithreading with Perl's DBI and Oracle?

查看:133
本文介绍了我可以使用Perl的DBI和Oracle多线程吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道使用Oracle DBI编写多线程Perl应用程序时的任何困难或问题?每个线程都有自己的连接到Oracle。



最长的时间我被告知多线程不支持Perl与Oracle。


< Perl DBI通过其内部执行单线程,因此驱动程序将只在一个会话上处于活动状态( $ dbh )。不管你有多少CPU。因此,不支持多线程(因为DBI中的所有内容都是单线程的),但是在多线程应用程序中使用DBI(以及DBD :: 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.

解决方案

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.

这篇关于我可以使用Perl的DBI和Oracle多线程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆