How to Set Timeout for Ruby ODBC Driver for SQL Server?

Posted by Seth Ladd on Stack Overflow See other posts from Stack Overflow or by Seth Ladd
Published on 2009-07-08T22:12:11Z Indexed on 2010/03/31 4:03 UTC
Read the original article Hit count: 648

Filed under:
|
|
|
|

Hello,

I would like to know how to explicitly set a timeout for the Ruby DBI ODBC driver, when connecting to SQL Server. I would like long running queries to simply timeout and cancel themselves, saving further server resources and Rails processes.

This was happening while we were using the ADO based Ruby driver, but now that we've switched to DBD::ODBC we are no longer experiencing timeouts.

I've looked around but cannot find out how to set the query timeout value. I've tried explicitly setting some values in the driver, and specifying both Timeout and ConnectionTimeout and Connect Timeout in the DSN configuration for the connection. No luck.

Your tips and advice are very appreciated.

Thanks! Seth

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about odbc