Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Database/DataSnap/Client    [ Add a report in this area ]  
Report #:  80954   Status: Closed
TSQLConnection Datasnap ConnectTimeout
Project:  Delphi Build #:  2010
Version:    14.0 Submitted By:   John-Arne Gangås
Report Type:  Basic functionality failure Date Reported:  1/8/2010 1:14:47 AM
Severity:    Serious / Highly visible problem Last Updated: 10/26/2014 11:39:49 PM
Platform:    All platforms Internal Tracking #:   14388
Resolution: Fixed (Resolution Comments) Resolved in Build: : 15.0.3827.31993
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: 10
At the datasnap server I set the TSQLConnection driver to datasnap and the ConnectTimeout to 5000.

The connecTimeout property value is never set to the underlying TIdTCPClientCustom IOHandler.

Added by Sysop
Steps to Reproduce:

Tomohiro Takahashi at 1/8/2010 4:56:43 PM -
What version of Delphi do you use, 2009 or 2010?
What RDBMS do you use? Is it SQL Server 2008?
And, could you please write Steps and attach sample project to understand/reporduce your issue?

John-Arne Gangås at 1/11/2010 11:31:05 PM -
I have added an TestProject.
The client TSQLCOnnection must be set up with an remote host.
It may be fictional, because we only want to test the client ConnectionTimeout.

Run the client in debug mode
You can see that the SQLConnection uses TDBXConnectionFactory to create a new DBXConnection.
TIdTCPClientCustom.Connect will eventually be called. (IdTCPClient.pas)

IOHandler.Port := FPort; //BGO: just to make sure
IOHandler.Host := FHost;
IOHandler.ConnectTimeout := FConnectTimeout;
IOHandler.ReadTimeout := FReadTimeout;

when these lines are reached Port and Host are the same as the properties set on the TSQLConnection at design time.
But ConnectTimeout still is the default value 0. Not the value set on the property "ConnectTimeout" set on the TSQLConnection.

If I could set the IOHandler.ConnectTimeout to a value of my choice AT RUNTIME. Problem solved.
IOHandler.ConnectTimeout := 5000;
Means that if the server is down the client tries to connect for 5 seconds before an exception is thrown.

Tomohiro Takahashi at 1/12/2010 7:20:37 PM -
I can not build your projects, because these are quite complicated and using some third-party components.
Please attach the SIMPLEST sample projects to understand/comfirm your issue.

John-Arne Gangås at 1/12/2010 11:57:54 PM -
I had been using Dev Express's grid. I have now replaced it with the TDBGrid.

I have now added only the client from the datasnap testProject.

Tomohiro Takahashi at 1/13/2010 4:58:03 PM -
> At the datasnap server I set the TSQLConnection driver to datasnap and the ConnectTimeout to 5000.
What does it mean? Are you trying to connect to DataSnap Server from client via TSQLConnection with Timeout?
If so, AFAIK, regarding to QoS(Quality of Service), DataSnap dbExpress driver layer does not support Timeout(e.g., connect timeout/ invocation timeout etc...), now.

John-Arne Gangås at 1/13/2010 11:49:08 PM -
That is wath I am trying to do. Client should Timeout when not beeing able to connect to the datasnap server.
The DBXConnection should support connecttimeout.
It uses Indy to open the connection. And Indy supports connecttimeout.
DBXConnection set host and port to the Indy client that actually opens the connection.
Why cant it set the timeout property at the same tima as it set the host and port?

Mida Converter at 2/9/2015 6:27:42 AM -

i have try with XE7 Update 1

mycon.Params.Values[TDBXPropertyNames.CommunicationTimeout] := '6000';
mycon.Params.Values[TDBXPropertyNames.CommunicationTimeout] := '7000';  ( 20 sec. of wait )

don't work.

in IdTCPClient.pas > procedure TIdTCPClientCustom.Connect;
OHandler.ConnectTimeout := FConnectTimeout;
OHandler.ReadTimeout := FReadTimeout;

FConnectTimeout and FReadTimeout are always empty.

Tomohiro Takahashi at 2/9/2015 4:48:07 PM -
Please put new QP(QualityPortal report) for XE7 Update1.

Kick Martens at 3/28/2017 2:52:57 AM -
This is not fixed. Tried it in XE7 up to XE10.1
When you set the connectTimeout through the params of a Datasnap (SQLconnection) it doesn't work

qin tan at 3/29/2017 9:57:29 AM -

qin tan at 3/29/2017 9:58:51 AM -
This should resolve the problem?

Server Response from: ETNACODE01