6.6.2-RC Connection Timeout

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
ChaosBiker
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 26.08.2008, 12:36

6.6.2-RC Connection Timeout

Post by ChaosBiker »

Is there a way to modify connection timeout?
Say be able to have connect give up after x number of seconds?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Depends on your database.
For mysql it should be as easy as adding 'timeout=x' to the ZConnection.Properties

Mark
Image
seawolf
Zeos Dev Team *
Zeos Dev Team *
Posts: 385
Joined: 04.06.2008, 19:50
Contact:

Post by seawolf »

Firebird at the moment does not support timeout=X but changing:

ZdbcInterbsae6.pas

Append at the end of "constructor TZInterbase6Connection.Create"

ConnectTimeout := StrToIntDef(Info.Values['timeout'], -1);
if ConnectTimeout >= 0 then
self.Info.Values['isc_dpb_connect_timeout'] := IntToStr(ConnectTimeout);

(declaring ConnectTimeout : integer; at the beginning of that function)

ZDbcInterbase6Utils.pas

case ParamNo of
0: Continue;
isc_dpb_set_db_SQL_dialect:
Dialect := StrToIntDef(ParamValue, 0);
isc_dpb_user_name, isc_dpb_password, isc_dpb_password_enc,
isc_dpb_sys_user_name, isc_dpb_license, isc_dpb_encrypt_key,
isc_dpb_lc_messages, isc_dpb_lc_ctype, isc_dpb_sql_role_name, isc_dpb_connect_timeout:

Adding "isc_dpb_connect_timeout" after ", isc_dpb_sql_role_name, "
ChaosBiker
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 26.08.2008, 12:36

Post by ChaosBiker »

"
Depends on your database.
For mysql it should be as easy as adding 'timeout=x' to the ZConnection.Properties
"

asume x is in seconds?

does the same work for MSSQL ?
ChaosBiker
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 26.08.2008, 12:36

Post by ChaosBiker »

adding
timeout=5
to properties, does NOT seem to work :(
it's still sitting waiting there for quite a while, until it finally gives up...
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I think you were using Mssql...

Can you set a debug point in procedure TZDBLibConnection.InternalLogin ? In that function the timeout value should be set Can you step trough to see if that's handled allright?. If you're using the ADO protocol, the timeout property isn't supported, however.
Image
ChaosBiker
Fresh Boarder
Fresh Boarder
Posts: 22
Joined: 26.08.2008, 12:36

Post by ChaosBiker »

usign MSSQL

once I get that working mysql is next.
will have a look at the TZDBLibConnetion
Post Reply