Is it possible to change default OLEDB connection timeout value? Run-time error (80040e31)

37,797

Solution 1

I found the answer here. It is the command timeout and it must be configured from particular command object.

Solution 2

Connect timeout is the limit of time to connect to the server, not to execute a command, so setting it will not help at all

Solution 3

There is property called "Connect Timeout". You can add this property to the connection string available in your application.

Below is the sample connection string with user specified timeout value: (Note: Connect Timeout value is always in seconds)

connectionString="Data Source=ServerName;Initial Catalog=DatabaseName;User ID=sa;Password=tiger;Connect Timeout=200"

Share:
37,797
Andrey Morozov
Author by

Andrey Morozov

Solutions Developer in both .NET and Java worlds. Sql Server pro. var Specialties = new List<string>() { "DWH/ETL/BI Solutions", "Systems Integration", "Data Analysis", "Reporting", "Enterprise Applications", "Database Development", "Distributed Applications", "Rich Desktop Applications", };

Updated on January 11, 2020

Comments

  • Andrey Morozov
    Andrey Morozov over 4 years

    I have one legacy app (VB) and I have an issue with the timeout error while connecting to SQL Server (probably through OLEDB).

    enter image description here

    Using SQL Profiler I figure out that the connection is dropped through exactly 30 seconds.

    enter image description here

    I don't have access to the source codes but I scanned exe resources and couldn't find any hardcoded connection string timeout values there.

    The last chance I think I have is to change the default OLEDB timeout somewhere outside the app.

    My question is: it is possible to change default OLEDB timeout value?


    UPDATE

    I found the connection string and changed timeout to 300 but it does not help...

    Provider=SQLOLEDB.1;Persist Security Info=False;User ID=______;Password=______;Initial Catalog=________;Data Source=______;Connect Timeout=300
    

    After that I tried to replace current connection string with connection strings from different providers: ADO.NET and ODBC but every time I get an timeout error after 30 seconds - checkmate.

    P.S.

    I'll be happy to any advice