You could also just make sure something like the following is in a my.cnf file (on my system it's /var/lib/mysql/my.cnf):
[perl]
default-character-set=utf8

And then when you connect, you'll need to specify two options to DBI to make DBD::mysql read from the option file:
DBI->connect( 'dbi:mysql:localhost;mysql_read_default_group=perl;mysql_read_default_file=/var/lib/mysql/my.cnf');

In playing with it a bit, only the first option (the default_group) is necessary but I'm not sure if that's intentional behavior (it's not documented as such).

Having this information embedded in your dsn or connection options will allow you to use Apache::DBI (since presumably it uses the same options you passed in when you originally connected).

Brian

On 11/4/05, Philip M. Gollucci <[EMAIL PROTECTED]> wrote:
> But I can't help feeling I'm redesigning the wheel here - would I have the same
> problem if I used Apache::DBI? Are there other easier ways to handle this?
IIRC, Apache::DBI just makes the connection persistant.  It could still
time out and disconnect if a handle in the handle cache isn't used.  AKA
the MySQL Morning bug.

It would likely make it more infrequent though.

I never remember which, but DBD and/or DBI document turning on the
auto_reconnect attribute.


--
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com


Reply via email to