[Dbix-class] Class::Storage::DBI, connect_info/on_connect_do

Matt S Trout dbix-class at trout.me.uk
Fri Jun 22 18:25:52 GMT 2007


On Fri, Jun 22, 2007 at 01:05:18PM -0400, John Goulah wrote:
> On 6/22/07, Matt S Trout <dbix-class at trout.me.uk> wrote:
> >
> >On Fri, Jun 22, 2007 at 10:30:24AM -0400, John Goulah wrote:
> >> On 6/22/07, Tim Bunce <Tim.Bunce at pobox.com> wrote:
> >> >
> >> >On Thu, Jun 21, 2007 at 05:56:57PM -0400, John Goulah wrote:
> >> >>    On 6/21/07, Adam Bartosik <[1]adam.bartosik at hurra.com> wrote:
> >> >>
> >> >>      > I would recommend for now explicitly setting
> >> >"mysql_auto_reconnect =>
> >> >>      > 0" in your connect_info options hashref and seeing if this
> >clears
> >> >up
> >> >>      > your problem.
> >> >>
> >> >>      Yes, setting
> >> >>      mysql_auto_reconnect => 0
> >> >>      disables internal DBD handling of auto-reconnect and
> >on_connect_do
> >> >SQLs
> >> >>      works.
> >> >>
> >> >>    I tried this setting and actually it prevented me from connecting
> >at
> >> >all.  I tried it out since I plan
> >> >>    to run under mod_perl.   This is more of an FYI thing, but if
> >anyone
> >> >has ideas on why this would happen
> >> >>    I'd love to hear it-
> >> >
> >> >It's hard to help without seeing the error message and, ideally, a
> >small
> >> >test case.
> >> >
> >> >Tim.
> >>
> >>
> >>
> >> Actually, sorry, this appears to be more of a Catalyst config issue (and
> >> obviously this is the wrong list).
> >>
> >> If i define my settings with  "__PACKAGE__->config"  everything is fine.
> >>
> >> If I use a yaml file , like:
> >>
> >> Model::MyDB:
> >>     schema_class: My::Schema
> >>     connect_info:
> >>          - 'dbi:mysql:dbname=mydb'
> >>          - 'user'
> >>          - 'pass'
> >>          - AutoCommit: 1
> >>          - mysql_auto_reconnect: 0
> >>
> >>
> >> I have to comment out either AutoCommit or mysql_auto_reconnect  for it
> >to
> >> work, so obviously I'm setting this up wrong when it comes to these
> >> options.  Again I know this is the wrong list, so perhaps I'll go back
> >to
> >> the Catalyst list if no one has a quick answer.
> >
> >This is neither a DBIC nor a Catalyst issue.
> >
> >You've fucked up the YAML syntax.
> >
> >Might I recommend the YAML specification and/or the ysh command line tool.
> >
> >Or use a config format you understand - I personally tend to use either
> >JSON
> >or .conf (Config::General), both of which ConfigLoader natively supports.
> 
> 
> 
> Thanks for the pointers, I didn't know about ysh, and I didn't  mean to
> infer that this was a Catalyst or DBIC issue as much as a problem with how
> _I_ configured it.
> 
> If it helps anyone, here is the solution.
> 
> Model::MyDB:
>     schema_class: My::Schema
>     connect_info:
>          - 'dbi:mysql:dbname=mydb'
>          - 'user'
>          - 'pass'
>          - AutoCommit: 1
>            mysql_auto_reconnect: 0

Looks about right.

I do really, passionately hate YAML - every time I get lumbered using the
horrible thing I resort to ysh.

<Model MyDB>
  schema_class My::Schema
  connect_info dbi:mysql:dbname=mydb
  connect_info user
  connect_info pass
  <connect_info>
    AutoCommit 1
    mysql_auto_reconnect 0
  </connect_info>
</Model>

makes me a lot happier :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list