这意味着你的代码里面多次打开了 DB,虽然是全局变量,但是可能被反复覆盖了,可以跟踪一下代码,监控 $dbh,看看是否有覆盖。
写好程序要多参考样本样本代码,全局变量常常是各种问题的开始。 http://www.masonhq.com/docs/manual/Admin.html#global_variables Since all components run in the same package, you'll be able to set the global in one component and access it in all the others. Autohandlers are common places to assign values to globals. Use the <%once>section if the global only needs to be initialized at load time, or the <%init> section if it needs to be initialized every request. Chat Skype: joejiang799 MSN: [email protected] Contact Me [image: Linkedin]<http://cn.linkedin.com/pub/joe-jiang/12/552/940> [image: Flickr] <http://www.flickr.com/photos/40820...@n04> --- @ WiseStamp Signature <http://www.wisestamp.com/email-install>. Get it now <http://www.wisestamp.com/email-install> 2009/12/22 joe jiang <[email protected]> > 请考虑一下 dbh 的生命期问题。就像 beckheng 建议的。 > > > > Chat Skype: joejiang799 MSN: [email protected] > Contact Me [image: Linkedin]<http://cn.linkedin.com/pub/joe-jiang/12/552/940> > [image: > Flickr] <http://www.flickr.com/photos/40820...@n04> > > > --- @ WiseStamp Signature <http://www.wisestamp.com/email-install>. Get it > now <http://www.wisestamp.com/email-install> > > > 2009/12/22 joewu <[email protected]> > >> >> >> 2009/12/22 joewu <[email protected]> >> >>> >>> >>> 2009/12/22 smallfish <[email protected]> >>> >>>> 没听说0是无限大,你可以设置一个数值试试。 >>>> >>>> -- >>>> blog: http://chenxiaoyu.org/blog/ >>>> >>>> >>>> 2009/12/22 joewu <[email protected]> >>>> >>>> >>>>> >>>>> 2009/12/22 smallfish <[email protected]> >>>>> >>>>> 恩,对的。需要加大下mysql的max_connection参数了。 >>>>>> 在你的my.cnf里改改。 >>>>>> -- >>>>>> blog: http://chenxiaoyu.org/blog/ >>>>>> >>>>>> >>>>>> 2009/12/22 joe jiang <[email protected]> >>>>>> >>>>>> Apache 里面调用 DBI 的时候,关闭其实没有任何用的。因为这个 disconnect 被 override 了。 >>>>>>> >>>>>>> >>>>>>> Chat Skype: joejiang799 MSN: [email protected] >>>>>>> Contact Me [image: >>>>>>> Linkedin]<http://cn.linkedin.com/pub/joe-jiang/12/552/940> [image: >>>>>>> Flickr] <http://www.flickr.com/photos/40820...@n04> >>>>>>> >>>>>>> >>>>>>> --- @ WiseStamp Signature <http://www.wisestamp.com/email-install>. Get >>>>>>> it now <http://www.wisestamp.com/email-install> >>>>>>> >>>>>>> >>>>>>> 2009/12/22 joewu <[email protected]> >>>>>>> >>>>>>> 在最顶层的autohandler放置了链接方法代码如下: >>>>>>>> my $dsn="DBI:mysql:vb:localhost"; >>>>>>>> my $username='root'; >>>>>>>> my $password='7232830'; >>>>>>>> my %conn_attrs=(RaiseError=>1,PrintErros=>0,AutoCommit=>1); >>>>>>>> $dbh=DBI->connect($dsn,$username,$password,\%conn_attrs); >>>>>>>> >>>>>>>> $dbh->disconnect(); >>>>>>>> >>>>>>>> 验证密码的模块 代码是 $m->comp('validate_password.mas',%ARGS)!=1 >>>>>>>> >>>>>>>> 然后不段的按 submit按钮,第一次没问题 第二次没问题 。但是一直按 下去 就会出现下面的 错误: >>>>>>>> DBI connect('vb:localhost','root',...) failed: Too many connections >>>>>>>> ; >>>>>>>> >>>>>>>> 奇怪的是 链接在autohander 已经关闭了 为什么还会出现这种情况呢? >>>>>>>> 应该怎么解决啊? >>>>>>>> >>>>>>>> -- >>>>>>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 >>>>>>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 >>>>>>>> 要取消订阅此网上论坛,请发送电子邮件至 >>>>>>>> [email protected]<perlchina%[email protected]> >>>>>>>> 。 >>>>>>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN访问此网上论坛。 >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 >>>>>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 >>>>>>> 要取消订阅此网上论坛,请发送电子邮件至 >>>>>>> [email protected]<perlchina%[email protected]> >>>>>>> 。 >>>>>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN访问此网上论坛。 >>>>>>> >>>>>> >>>>>> -- >>>>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 >>>>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 >>>>>> 要取消订阅此网上论坛,请发送电子邮件至 >>>>>> [email protected]<perlchina%[email protected]> >>>>>> 。 >>>>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 >>>>>> >>>>> max_connection 是设置为0的 就是没有限制。那应该是最大的了。但是还会出现那种问题哦。 >>>>> >>>>> -- >>>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 >>>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 >>>>> 要取消订阅此网上论坛,请发送电子邮件至 >>>>> [email protected]<perlchina%[email protected]> >>>>> 。 >>>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 >>>>> >>>> >>>> -- >>>> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 >>>> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 >>>> 要取消订阅此网上论坛,请发送电子邮件至 >>>> [email protected]<perlchina%[email protected]> >>>> 。 >>>> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 >>>> >>> 我设置了10000然后尽可能快的按submit 大概一分钟这样子就出错了 >>> >>> 并不太快的按 数了下 在50次后出了问题。 >> >> -- >> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 >> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 >> 要取消订阅此网上论坛,请发送电子邮件至 >> [email protected]<perlchina%[email protected]> >> 。 >> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 >> > > -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
