# ODBC database timeout

**URL:** <https://forum.xojo.com/t/odbc-database-timeout/77649>\
**Category:** Databases\
**Created:** [October 13, 2023, 9:36am UTC](https://forum.xojo.com/t/odbc-database-timeout/77649 "2023-10-13T09:36:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samiul\_Hassan1](https://forum.xojo.com/letter_avatar_proxy/v4/letter/s/b3f665/32.png) [@Samiul\_Hassan1](https://forum.xojo.com/u/Samiul_Hassan1)\
**Post date:** [October 13, 2023, 9:36am UTC](https://forum.xojo.com/t/odbc-database-timeout/77649/1 "2023-10-13T09:36:02Z")

</div>

I have just seen that `MSSQLServerDatabase` is now deprecated so I am moving over to using `ODBCDatabase`.  
I understand the connection timeout can be set in the connection string using the `Connection Timeout` parameter.  
When I did a test query I got a `DatabaseException`:

[Microsoft][ODBC Driver 17 for SQL Server]Query timeout expired

The documentation states that the Timeout property is the connection timeout and therefore I assume not the query timeout:  
[ODBCDatabase — Xojo documentation](https://documentation.xojo.com/api/databases/odbcdatabase.html#odbcdatabase-timeout)

However, if I set the `Timeout` to say 60 seconds, the query works fine. Therefore, is the documentation wrong and the `Timeout` property is actually the query (command) timeout?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Monroe](https://forum.xojo.com/user_avatar/forum.xojo.com/jonathan_monroe/32/14326_2.png) [@Jonathan\_Monroe](https://forum.xojo.com/u/Jonathan_Monroe)\
**Post date:** [October 16, 2023, 9:41pm UTC](https://forum.xojo.com/t/odbc-database-timeout/77649/2 "2023-10-16T21:41:37Z")

</div>

Setting the ODBCDatabase.Timeout property will set both the connection SQL\_ATTR\_LOGIN\_TIMEOUT and statement SQL\_ATTR\_QUERY\_TIMEOUT attributes to the value you set:

Dim db as New ODBCDatabase  
db.Timeout = 60

Jonathan
