You are not logged in.
Pages: 1
Made your descendant of TSQLDBServerHttpApi to access protected FServer: THttpServerGeneric TSqlDBServerAbstract member.
Add FServer.OnHttpThreadTerminate handler, and inside added handles call Properties.EndCurrentThread
Pseudo-code:FHttpServer.FServer.OnHttpThreadTerminate = function() begin Properties.EndCurrentThread; end;
As alternative - use an ODBC connection instead of OleDB
Thank you. I will try that.
I have noticed some problems with TSQLDBServerHttpApi when using a thread pool with TOleDBMSSQL2012ConnectionProperties. The Ole CoUninit assertion seems to fail at times.
The Server runs in a Windows Service:
FProps := TOleDBMSSQL2012ConnectionProperties.Create('127.0.0.1\SQLEXPRESS','test','test','test');
FHttpServer := TSQLDBServerHttpApi.Create(FProps,'test',80,'test','test',False,64,nil,tmThreadPool);
The Client connection is created in a datamodule constructor and freed in the destructor:
http := TSQLDBWinHTTPConnectionProperties.Create(...)
statement := http.NewThreadSafeStatementPrepared(SomeSQL,True,True);
....parameter binding....
statement.ExecutePrepared;
Seeing this in the log at times:
20220715 06004760 ' ERROR "EAssertionFailed(125fef00)":"You should call TOleDBConnection.Free from the same thread which called its Create: i.e. call MyProps.EndCurrentThread from an THttpServerGeneric.OnHttpThreadTerminate event - see ticket 213544b2f5
Memory allocation seems to keep increasing over time because of this. . I tried using a HttpThreadTerminate event calling TSQLDBConnectionPropertiesThreadSafe(FProperties).EndCurrentThread, but the problem persists; Please help.
Sadly it is hardcoded...
Yes, TSqlDbProxyStatementColumns is a set limited to 256 elements. Changing this to an array is a way around this limit.
I'm having a problem with a stored procedure that returns 300+ columns. FetchAllToBinary throws a 'Too Many Columns' exception. Unfortunately I'm unable to modify the procedure to return less columns. Any suggestions?
FillChar(Null,sizeof(Null),0);
result := 0;
W := TFileBufferWriter.Create(Dest);
try
W.WriteVarUInt32(FETCHALLTOBINARY_MAGIC);
FMax := ColumnCount;
W.WriteVarUInt32(FMax);
if FMax>0 then begin
// write column description
SetLength(ColTypes,FMax);
dec(FMax);
for F := 0 to FMax do begin
W.Write(ColumnName(F));
ColTypes[F] := ColumnType(F,@FieldSize);
W.Write1(ord(ColTypes[F]));
W.WriteVarUInt32(FieldSize);
end;
// initialize null handling
NullRowSize := (FMax shr 3)+1;
if NullRowSize>sizeof(Null) then <-------------------------
raise ESQLDBException.CreateUTF8(
'%.FetchAllToBinary: too many columns',[self]);
Thanks for the reply. I got it working by calling RegisterCompress and by increasing the send/recieve timeouts. Now I'm having another problem with a stored proc that returns 300+ columns. FetchAllToBinary throws a 'Too Many Columns' exception. Any suggestions?
Does 50k rows and 100+ columns take more than 20 seconds to be retrieved on server side?
Negative. It executes in SSMS after about 2 seconds. I also ran a trace on the server and it was also done in about 2 seconds.
Does anyone have any suggestions? Should I attempt to use a specific type of compression? Any examples/suggestions would be very much appreciated.
I'm attempting to migrate an old legacy project from ADO/Soap to something a little faster. TSQLDBServerHttpApi seems to be working fine for normal selects, inserts and stored procedures. My problem is with stored procedures that return very large result sets that are need for certain reports (up to 50k rows and 100+ columns - Unfortunately I'm unable to change the logic for these stored procedures). I'm getting WinHTTP.dll timeouts on the client after about 20 seconds. I have tried increasing the client KeepAliveMS with no success. Any help would be appreciated.
Server:
Props := TOleDBMSSQL2012ConnectionProperties.Create('127.0.0.1','ReportsDB','user','password');
HttpServer := TSQLDBServerHttpApi.Create(Props,'ReportsDB','8787','user','password');
HttpServer.Properties.ConnectionTimeOutMinutes := 2;
Client:
http := TSQLDBWinHTTPConnectionProperties.Create('1.2.3.4:8787','ReportsDB','user','pass');
try
ds := TDataSet.Create(Self);
sql:= 'exec GetReportsSP param1, param2, param3';
ds := ToDataSet(ds,http.Execute(sql,[]));
PopulateGrid(ds);
finally
ds.Free;
end;
Pages: 1