Board index » delphi » Connections with Gupta hangs

Connections with Gupta hangs


2006-09-11 11:02:25 PM
delphi78
Hello! I have an application looping through all our stores. For each store
I create a ADOConnection and then I execute an ADOQuery. After this I close
the ADOQuery and the ADOConnection and move on to the next store.
My problem is that sometimes (every 500 connection or so) the ADOQuery hangs
on OPEN.
I tried to set CommandTimeout without ant improvement.
The database is an Gupta SQLBase and the driver version is 9.00.01.13768
Below i part of the code that can be of interest...
Regards, Mikael
-- Code to setup my connection
ConnStr := 'Provider=SQLBASEOLEDB.1;';
ConnStr := ConnStr + 'Password="' + SQLPassword + '";';
ConnStr := ConnStr + 'Persist Security Info=True;';
ConnStr := ConnStr + 'User ID=' + SQLUserName + ';';
ConnStr := ConnStr + 'Data Source=' + SQLServerName +';';
ADOStoreConnection.ConnectionString := ConnStr;
ADOStoreConnection.CommandTimeout := 30;
ADOStoreConnection.ConnectionTimeout := 10;
ADOStoreConnection.CursorLocation := clUseClient;
ADOStoreConnection.KeepConnection := False;
ADOStoreConnection.LoginPrompt := False;
ADOStoreConnection.Open;
ADOStoreQuery.CommandTimeout := 30;
ADOStoreQuery.ExecuteOptions := [eoAsyncFetchNonBlocking];
ADOStoreQuery.CursorLocation := clUseClient;
-- Code for my query (it hangs on Open)
DBForm.ADOStoreQuery.SQL.Clear;
DBForm.ADOStoreQuery.SQL.Add('Select Sum(SoldValue) As SoldValue,
Sum(SoldQuant) As SoldQuant, Sum(SoldDisc) As SoldDisc');
DBForm.ADOStoreQuery.SQL.Add('From SoldDayArtTemp');
DBForm.ADOStoreQuery.SQL.Add('Where Shop = ' + Store);
DBForm.ADOStoreQuery.SQL.Add('And Period = ' +
QuotedStr(FormatDateTime('yyyy-mm-dd', Now)));
DBForm.ADOStoreQuery.Open;
 
 

Re:Connections with Gupta hangs

Quote
ADOStoreConnection.Open;
Instead of calling Open on the ADOConnection try adding this
to your code and see if it helps.
type
TcADOConnection = class(TADOConnection);
-- Code to setup my connection
ConnStr := 'Provider=SQLBASEOLEDB.1;';
ConnStr := ConnStr + 'Password="' + SQLPassword + '";';
ConnStr := ConnStr + 'Persist Security Info=True;';
ConnStr := ConnStr + 'User ID=' + SQLUserName + ';';
ConnStr := ConnStr + 'Data Source=' + SQLServerName +';';
ADOStoreConnection.ConnectionString := ConnStr;
ADOStoreConnection.CommandTimeout := 30;
ADOStoreConnection.ConnectionTimeout := 10;
ADOStoreConnection.CursorLocation := clUseClient;
ADOStoreConnection.KeepConnection := False;
ADOStoreConnection.LoginPrompt := False;
TcADOConnection(ADOStoreConnection).CheckActive;
CheckActive is implemented in AdoDB.pas but it is Protected so it
can only be called from a descendant class that is why
the TcADOConnection was declared. CheckActive it will setup a
WaitTillComplete loop and not timeout right away.
 

Re:Connections with Gupta hangs

Thanks , I tried it but it didn't help! Any more ideas?
regards, Mikael
"Dennis Passmore" <XXXX@XXXXX.COM>writes
Quote
>ADOStoreConnection.Open;

Instead of calling Open on the ADOConnection try adding this
to your code and see if it helps.

type
TcADOConnection = class(TADOConnection);

-- Code to setup my connection
ConnStr := 'Provider=SQLBASEOLEDB.1;';
ConnStr := ConnStr + 'Password="' + SQLPassword + '";';
ConnStr := ConnStr + 'Persist Security Info=True;';
ConnStr := ConnStr + 'User ID=' + SQLUserName + ';';
ConnStr := ConnStr + 'Data Source=' + SQLServerName +';';
ADOStoreConnection.ConnectionString := ConnStr;
ADOStoreConnection.CommandTimeout := 30;
ADOStoreConnection.ConnectionTimeout := 10;
ADOStoreConnection.CursorLocation := clUseClient;
ADOStoreConnection.KeepConnection := False;
ADOStoreConnection.LoginPrompt := False;
TcADOConnection(ADOStoreConnection).CheckActive;


CheckActive is implemented in AdoDB.pas but it is Protected so it
can only be called from a descendant class that is why
the TcADOConnection was declared. CheckActive it will setup a
WaitTillComplete loop and not timeout right away.