dongquanlin1885
2011-09-17 08:28
浏览 98
已采纳

PHP PDO:设置FireBird连接超时

I'm connecting to a FireBird database, which works fine when the database is online. When the server is offline, the user gets an max execution time passed error.

Therefore I want to surround the connection statement with a try catch and set the timeout to 10 seconds. But I can't find the right attribute to do so. The default ATTR_TIMEOUT doesn't seem to work. Can anyone tell me if this is possible with PDO and FireBird?

图片转代码服务由CSDN问答提供 功能建议

我正在连接到FireBird数据库,该数据库在数据库联机时工作正常。 当服务器脱机时,用户会收到最大执行时间错误。

因此,我想用try catch包围连接语句,并将超时设置为10秒。 但我找不到合适的属性。 默认的 ATTR_TIMEOUT 似乎不起作用。 任何人都可以告诉我PDO和FireBird是否可行吗?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dstobkpm908182 2011-09-17 09:54
    已采纳

    Not sure about PHP / PDO but there is ConnectionTimeout parameter in the firebird.conf file you could try. The default value is 180 seconds (quote from conf file):

    # ----------------------------
    # Client Connection Settings (Basic)
    #
    # Seconds to wait before concluding an attempt to connect has failed.
    #
    # Type: integer
    #
    #ConnectionTimeout = 180
    

    If your FireBird server is not in the same server where the PHP script runs and you don't have firebird.conf file on the "PHP server", then try to put one into same directory where the fbclient dll is. Or if there is FIREBIRD enviroment variable defined, then into the directory that var points to.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题