Python论坛  - 讨论区

标题:[python-chinese] MySQLdb如何判断数据库连接有效?

2008年01月15日 星期二 16:40

kun xu coonxu在gmail.com
星期二 一月 15 16:40:04 HKT 2008

×öÁËÒ»¸ö³ÌÐò£¬Óõ½MySQLdb£¬Õâ¸ö³ÌÐòÐèÒªÒ»Ö±±£³Ö¶ÔÊý¾Ý¿âµÄÁ¬½Ó£¬Ã»ÓÐÔÚÎĵµÖп´µ½ÈçºÎÅжϵ±Ç°Êý¾Ý¿âÁ´½ÓÓÐЧµÄº¯Êý£¿
ÓÐûÓÐÓùýµÄÐֵܸø¸öÌáʾ¡£
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080115/13571d74/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月15日 星期二 20:13

luo roger roger.maillist在gmail.com
星期二 一月 15 20:13:51 HKT 2008

ÓÃÊý¾Ý¿âÁ¬½Ó³ØDbutils£¬ºÃÏñ¿ÉÒÔ×Ô¶¯ÖØÁ¬µÄ¡£

ÔÚ08-1-15£¬kun xu <coonxu在gmail.com> дµÀ£º
>
> ×öÁËÒ»¸ö³ÌÐò£¬Óõ½MySQLdb£¬Õâ¸ö³ÌÐòÐèÒªÒ»Ö±±£³Ö¶ÔÊý¾Ý¿âµÄÁ¬½Ó£¬Ã»ÓÐÔÚÎĵµÖп´µ½ÈçºÎÅжϵ±Ç°Êý¾Ý¿âÁ´½ÓÓÐЧµÄº¯Êý£¿
> ÓÐûÓÐÓùýµÄÐֵܸø¸öÌáʾ¡£
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080115/9181b05e/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月15日 星期二 21:09

leopay leopay在gmail.com
星期二 一月 15 21:09:48 HKT 2008

connection.ping()

On 1/15/08, luo roger <roger.maillist在gmail.com> wrote:
>
> ÓÃÊý¾Ý¿âÁ¬½Ó³ØDbutils£¬ºÃÏñ¿ÉÒÔ×Ô¶¯ÖØÁ¬µÄ¡£
>
> ÔÚ08-1-15£¬kun xu <coonxu在gmail.com> дµÀ£º
> >
> > ×öÁËÒ»¸ö³ÌÐò£¬Óõ½MySQLdb£¬Õâ¸ö³ÌÐòÐèÒªÒ»Ö±±£³Ö¶ÔÊý¾Ý¿âµÄÁ¬½Ó£¬Ã»ÓÐÔÚÎĵµÖп´µ½ÈçºÎÅжϵ±Ç°Êý¾Ý¿âÁ´½ÓÓÐЧµÄº¯Êý£¿
> > ÓÐûÓÐÓùýµÄÐֵܸø¸öÌáʾ¡£
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080115/44b86874/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月15日 星期二 21:14

leopay leopay在gmail.com
星期二 一月 15 21:14:31 HKT 2008

>>> help(MySQLdb.connection.ping)
Help on method_descriptor:

ping(...)
    Checks whether or not the connection to the server is
    working. If it has gone down, an automatic reconnection is
    attempted.

    This function can be used by clients that remain idle for a
    long while, to check whether or not the server has closed the
    connection and reconnect if necessary.

    New in 1.2.2: Accepts an optional reconnect parameter. If True,
    then the client will attempt reconnection. Note that this setting
    is persistent. By default, this is on in MySQL<5.0.3, and off
    thereafter.

    Non-standard. You should assume that ping() performs an
    implicit rollback; use only when starting a new transaction.
    You have been warned.


On 1/15/08, leopay <leopay在gmail.com> wrote:
>
> connection.ping()
>
> On 1/15/08, luo roger <roger.maillist在gmail.com> wrote:
> >
> > ÓÃÊý¾Ý¿âÁ¬½Ó³ØDbutils£¬ºÃÏñ¿ÉÒÔ×Ô¶¯ÖØÁ¬µÄ¡£
> >
> > ÔÚ08-1-15£¬kun xu <coonxu在gmail.com> дµÀ£º
> > >
> > > ×öÁËÒ»¸ö³ÌÐò£¬Óõ½MySQLdb£¬Õâ¸ö³ÌÐòÐèÒªÒ»Ö±±£³Ö¶ÔÊý¾Ý¿âµÄÁ¬½Ó£¬Ã»ÓÐÔÚÎĵµÖп´µ½ÈçºÎÅжϵ±Ç°Êý¾Ý¿âÁ´½ÓÓÐЧµÄº¯Êý£¿
> > > ÓÐûÓÐÓùýµÄÐֵܸø¸öÌáʾ¡£
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese在lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request在lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080115/a3f2bbc1/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2008年01月16日 星期三 17:37

kun xu coonxu在gmail.com
星期三 一月 16 17:37:00 HKT 2008

лл¸÷λ£¬Ö®Ç°¶¼ÊÇÓÃÅ×Òì³£µÄ·½Ê½´¦ÀíÊý¾Ý¿â¿ÉÄܳöÏÖÁ¬½Ó¶Ï¿ªµÄÎÊÌ⣬ÏÖÔÚºÃÁË£¬ÔٴθÐл¡£


ÔÚ08-1-15£¬leopay <leopay在gmail.com> дµÀ£º
>
> >>> help(MySQLdb.connection.ping)
> Help on method_descriptor:
>
> ping(...)
>     Checks whether or not the connection to the server is
>     working. If it has gone down, an automatic reconnection is
>     attempted.
>
>     This function can be used by clients that remain idle for a
>     long while, to check whether or not the server has closed the
>     connection and reconnect if necessary.
>
>     New in 1.2.2: Accepts an optional reconnect parameter. If True,
>     then the client will attempt reconnection. Note that this setting
>     is persistent. By default, this is on in MySQL<5.0.3, and off
>     thereafter.
>
>     Non-standard. You should assume that ping() performs an
>     implicit rollback; use only when starting a new transaction.
>     You have been warned.
>
>
> On 1/15/08, leopay <leopay在gmail.com> wrote:
> >
> > connection.ping()
> >
> > On 1/15/08, luo roger <roger.maillist在gmail.com > wrote:
> > >
> > > ÓÃÊý¾Ý¿âÁ¬½Ó³ØDbutils£¬ºÃÏñ¿ÉÒÔ×Ô¶¯ÖØÁ¬µÄ¡£
> > >
> > > ÔÚ08-1-15£¬kun xu <coonxu在gmail.com> дµÀ£º
> > > >
> > > > ×öÁËÒ»¸ö³ÌÐò£¬Óõ½MySQLdb£¬Õâ¸ö³ÌÐòÐèÒªÒ»Ö±±£³Ö¶ÔÊý¾Ý¿âµÄÁ¬½Ó£¬Ã»ÓÐÔÚÎĵµÖп´µ½ÈçºÎÅжϵ±Ç°Êý¾Ý¿âÁ´½ÓÓÐЧµÄº¯Êý£¿
> > > > ÓÐûÓÐÓùýµÄÐֵܸø¸öÌáʾ¡£
> > > >
> > > >  _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese在lists.python.cn
> > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > > > Unsubscribe: send unsubscribe to
> > > > python-chinese-request在lists.python.cn
> > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > > >
> > >
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese在lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request在lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> >
> >
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to   python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20080116/0708452a/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号