3

症状是:

TinyTds::Error: Adaptive Server 连接超时:EXEC some_stored_procedure

这是execute_procedure通过 ActiveRecord over 在慢速 MSSQL Server 上的慢速存储过程tinytds。如果我EXEC在 SQL 查询分析器中存储过程,它需要 29 到 30 才能完成。

所以我补充说:

timeout = 60

/etc/freetds.conf和:

read_timeout: 60
write_timeout: 60

database.yml.

同样的错误仍然出现。还有其他我错过的配置吗?

ps 我确实测量了按下返回键后超时错误出现的时间,大约是 30 秒。我有一种感觉 30 秒可能不是 or 的默认超时,freetds并且activerecord 想知道为什么错误显示的时间有点接近 sql 完成的时间......

4

1 回答 1

3

已经很长时间了,但有人可能需要这个。我通过传递timeout:用于创建 tiny_tds 客户端依赖于git doc的选项解决了这个问题,见下文:

client = TinyTds::Client.new username: 'sa', password: 'secret', host: 'mydb.host.net', timeout: 30
于 2017-03-31T13:18:53.087 回答