# DBI question - DBD-ADO query is timing out

**URL:** <https://www.ruby-forum.com/t/dbi-question-dbd-ado-query-is-timing-out/106024>\
**Category:** Ruby\
**Created:** [June 5, 2007, 7:29pm UTC](https://www.ruby-forum.com/t/dbi-question-dbd-ado-query-is-timing-out/106024 "2007-06-05T19:29:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BallS\_Donald\_A\_Jr\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@BallS\_Donald\_A\_Jr\_S](https://www.ruby-forum.com/u/BallS_Donald_A_Jr_S)\
**Post date:** [June 5, 2007, 7:29pm UTC](https://www.ruby-forum.com/t/dbi-question-dbd-ado-query-is-timing-out/106024/1 "2007-06-05T19:29:23Z")

</div>

Hey guys, I have a tiny DBI question. I’m using DBD-ADO to talk to  
sqlserver and have a query that’s timing out. Does anyone know how I  
might extend the timeout?

- donald

---

<div class="post-metadata">

**Author:** ![BallS\_Donald\_A\_Jr\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@BallS\_Donald\_A\_Jr\_S](https://www.ruby-forum.com/u/BallS_Donald_A_Jr_S)\
**Post date:** [June 5, 2007, 8:48pm UTC](https://www.ruby-forum.com/t/dbi-question-dbd-ado-query-is-timing-out/106024/2 "2007-06-05T20:48:35Z")

</div>

> Hey guys, I have a tiny DBI question. I’m using DBD-ADO to  
> talk to sqlserver and have a query that’s timing out. Does  
> anyone know how I might extend the timeout?

Never mind, I found a solution. If working from an ActiveRecord  
connection:

connection.instance\_variable\_get(:@connection).handle.  
instance\_variable\_get(:@handle).setproperty(‘CommandTimeout’, 3600)

Sure would be nice if something this useful could be manipulated more  
elegantly. Perhaps something to add to the todo list for DBI2 if and  
when Kirk gets that project off the ground.

Actually, on that note, I just ran into another problem with DBD-ADO,  
specifically with the autocommit mode. When it’s on, it only commits  
after a statement is executed if it thinks it’s a read operation. One  
problem is, the algorithm fails to treat SELECT INTO statements as write  
operations. I would think one would want to commit after all operations  
anyway if one’s in autocommit mode; it would seem you don’t really care  
about getting a consistent view of the database in that case.

- donald
