On Thu, 14 Apr 2011, Nan Cui wrote:

> When my code tried to create new
> threads, the logger in the sub-thread body threw out exception like this:
> thread failed to start: DBD::Oracle::db prepare failed: handle 2 is owned by
> thread 83e0008 not current thread 8973c18 (handles can't be shared between
> threads and your driver may need a CLONE method added) at

Hi Nan,

That might be a limitation in the Oracle driver. I'm not using Oracle
personally, but I've gotten feedback on the DBI driver being piece of
work, mainly due to the proprietary nature of the Oracle client
interface.

Anyway, if the driver doesn't allow sharing DB handles between Perl
threads, you should be able to work around the problem by explicitly
obtaining a new DB handle every time you create a new thread.

For this, you need to call the _init() method of Log4perl's DBI
appender, which you can do after retrieving the appender by name.
Something like

     Log::Log4perl->appender_by_name( "DBAppndr" )->_init();

in your consume() function should do the trick.

-- Mike

Mike Schilli
m...@perlmeister.com

------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to