Re: mod_perl, mysql, and set names

2005-11-06 Thread Daniel McBrearty
Thanks again for the varied responses. My main concern right now is to get this thing running reliably with minimum hassle. I've not had any connection related problems aprt from this "set names" related stuff. For now I'll take the minor hit of an extra query per request and issue "set names" eve

Re: mod_perl, mysql, and set names

2005-11-04 Thread Philip M. Gollucci
Adam Worrall wrote: I ended up hacking Apache::DBI to place the $conn into a @global, to prevent DESTROY from kicking in. Naughty resource leaks ahoy. The moral: it's surprisingly hard to get all this stuff working well ! Could maybe attach a diff ? -- END

Re: mod_perl, mysql, and set names

2005-11-04 Thread Perrin Harkins
On Fri, 2005-11-04 at 12:33 -0500, Malcolm J Harwood wrote: > Not always though. Something I've run into (but had problems tracking down > the > cause) is that if the db server is rebooted between requests, Apache::DBI can > think it's still got a valid handle and the db doesn't. The check is o

Re: mod_perl, mysql, and set names

2005-11-04 Thread Malcolm J Harwood
On Friday 04 November 2005 12:14 pm, Perrin Harkins wrote: > Apache::DBI checks the handle to make sure it is still connected before > handing it back to you. If it has been disconnected, a new connection > will be made. Not always though. Something I've run into (but had problems tracking dow

Re: mod_perl, mysql, and set names

2005-11-04 Thread Perrin Harkins
On Fri, 2005-11-04 at 11:53 -0500, Philip M. Gollucci 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 st

Re: mod_perl, mysql, and set names

2005-11-04 Thread Brian Phillips
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:lo

Re: mod_perl, mysql, and set names

2005-11-04 Thread Philip M. Gollucci
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. A

Re: mod_perl, mysql, and set names

2005-11-04 Thread Perrin Harkins
On Fri, 2005-11-04 at 13:34 +, Daniel McBrearty wrote: > It seems the problem is caused by the connection timing out, after which it > automatically reconnects - but set names is not then done. (I am not using > Apache::DBI.) > > Possible solutions: > - modify code to issue set names at the s

Re: mod_perl, mysql, and set names

2005-11-04 Thread Daniel McBrearty
Thanks to those who responded to me privately. It seems the problem is caused by the connection timing out, after which it automatically reconnects - but set names is not then done. (I am not using Apache::DBI.) Possible solutions: - modify code to issue set names at the start of every request (