> Philippe M. Chiasson wrote: > > 2 possible avenues to investigate: > > - Change your code to not use an array-ref as mx_dsns argument but some string (comma delimited, etc) > > - Look at changing Apache::DBI to not use the ref as part of the dsn cache key, but use the contents of the array > > something along the lines of : > > $Key = Dumper([EMAIL PROTECTED]); > > > > The arrayref is a requirment of multiplex. I'll do some hacking in both > modules and see what works. I'm not certain if the first possible change > would work as suggested as Apache::DBI would end up caching possibly > just one, if any of the multiple potential DB connections. The target > will be to cache a persistant connection for all DB servers that > multiplex is setup to query against. > > I'm not completly up to scratch when or how Apache::DBI does its magic, > either within the connect call of my DBI handle or within Multiplex's > (as multiplex does a similar thing to Apache::DBI in redirecting the > connect request).
Have you copied the example code from DBD::Multiplex? %attr = ( 'mx_dsns' => [$dsn1, $dsn2, $dsn3, $dsn4], 'mx_master_id' => 'dbaaa1', 'mx_connect_mode' => 'ignore_errors', 'mx_exit_mode' => 'first_success', 'mx_error_proc' => \&MyErrorProcedure, ); $dbh = DBI->connect("dbi:Multiplex:", 'username', 'password', \%attr); If so you're creating a NEW anonymous array everytime you build %attr. Try: my @dsns = ($dsn1, $dsn2, $dsn3, $dsn4); %attr = ( 'mx_dsns' => [EMAIL PROTECTED], 'mx_master_id' => 'dbaaa1', 'mx_connect_mode' => 'ignore_errors', 'mx_exit_mode' => 'first_success', 'mx_error_proc' => \&MyErrorProcedure, ); $dbh = DBI->connect("dbi:Multiplex:", 'username', 'password', \%attr); Or even better find someway of defining this stuff once, then re-using it. I'd suggest a custom DB settings module then when loaded initialises the required variables, and can return a DB handle to any other code when you need it.Carl