Subject Re: [firebird-support] Still threading problems
Author Martijn Tonies
Christian,

> I still have problems with threads. I built a service application with
> Indy TIdHttpServer. It works fine, if there are only some requests or
> if I run it on my laptop.
>
> But if I put it on our server (with Hyper Threading) and I simulate
> some load with Ctrl-R in the browser, at some the application is just
> killed, sometimes with exceptions (always in unit SqlExpr), most of
> the time with no feedback.
>
> I reduced the code in the request to a minimum and I don't see, what
> goes wrong:
>
>
> procedure TWebGetTestDB.TestWithDbx;
> var
> conn : TSQLConnection;
> qry : TSQLDataSet;
> s : String;
> begin
> conn := TSQLConnection.Create(nil);
>
> conn.LoginPrompt := False;
> conn.SQLHourGlass := False;
> conn.LoadParamsOnConnect := False;
> conn.ConnectionName := 'DATABASE';
> conn.DriverName := 'DBX_DRIVER';
> conn.LoginPrompt := False;
> conn.Params.Values['Database'] := 'localhost:\D:\mydb.fdb';
> conn.Params.Values['User_Name'] := 'SYSDBA';
> conn.Params.Values['Password'] := 'masterkey';
> conn.GetDriverFunc := 'getSQLDriverFB';
> conn.LibraryName := 'dbxup_fb.dll';
> conn.VendorLib := 'fbclient.dll';
> conn.Params.Values['DBX TransIsolation'] := 'ReadCommited';
> conn.Params.Values['ServerCharSet'] := 'ISO8859_1';
> conn.Open;

What happens if you only synchronize the Open?

> qry := TSQLDataSet.Create(nil);
> qry.SQLConnection := conn;
> qry.CommandText := 'select * from STYLE';
> qry.Prepared := True;
> qry.NoMetaData := True;
>
> qry.Open;
> qry.First;
> s := 'Data: ';
> while not qry.Eof do begin
> s := Format('%s - %d', [s, qry.FieldByName('STYLEID').AsInteger]);
> qry.Next;
> end; // while
> FResponse.ContentType := 'text/html';
> FResponse.ContentText := s;
>
> qry.Free;
> conn.Free;

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com