Page 1 of 1

Question on TMSConnection.ConnectionTimeout

Posted: Tue 09 May 2017 10:24
by brace
I would like to know as soon as possible when a Connection fails.

I tried to set TMSConnection.ConnectionTimeout to a low number of seconds for this.

In case of a sql authentication there are 4 parameters: user, password, server and database.

I noticed that if user, password or database are wrong the TMSConnection raises an exception immediately, independently from the value of ConnectionTimeout, while if the server is wrong the exception comes about after the number of seconds specified in ConnectionTimeout.

Somehow the server property "takes longer", why?

Thanks.

I have latest sdac.

Re: Question on TMSConnection.ConnectionTimeout

Posted: Thu 11 May 2017 14:12
by azyk
During establishing a connection SDAC refers to SQL Server and waits for its response. In case when Server does not exist or there is no access to it - SDAC will not get a response from SQL Server and after the ConnectionTimeout seconds it will raise an exception.

If there is access to Server, and Username/Password/Database are incorrect, then SDAC will not wait for the ConnectionTimeout seconds, and will give the app SQL Server response (error message) as soon as it gets it.

Re: Question on TMSConnection.ConnectionTimeout

Posted: Thu 11 May 2017 15:08
by brace
So which is the need for the ConnectionTimeout property? ANd why the defalut value is as big as 15 seconds?
Isn't it always better to have a reply asap?

Or this is to handle timing in some particuar scenarios?

Re: Question on TMSConnection.ConnectionTimeout

Posted: Fri 12 May 2017 12:18
by azyk
ConnectionTimeout determines the time for which SDAC will be waiting for a response from SQL Server when attempting to establich a connection. If SDAC gets a response from SQL Server earlier than for a number of seconds in ConnectionTimeout, then SDAC will immediately return a response from SQL Server to the application. If a response from the server does not come, then we will wait for a response for ConnectionTimeout seconds, and only then return an error that the connection failed to be established.

You can empirically find out optimal ConnectionTimeout value for a custom application in your environment.