Mark,

I have had good success lately using file-based databases as the overhead of
database connections is avoided. I currently favour DBISAM for this. When I
have used Interbase in the past I implemented connection pooling. Each
thread instantiates a new tsession and tquery and sets the matching session
names accross these components and the pooled tdatabase.

I prefer not to use Web Broker components - mainly because I have been doing
this ISAPI stuff since long before they appeared and have found little
reason to change. Although with Kylix I may have to.

regards,
Steve

The following is a simple straight ISAPI app without using a webmodule or
datamodule and compiles to a 831k dll most of which is the complete DBISAM
engine. With the database stuff commented out it becomes a 42k dll: (many
things omitted obviously for this demo)


library hello;

uses

  windows,
  sysutils,
  Isapi2,
  DBISAMTb;

const
  CR = #13#10;
  DataDir = 'c:\inetpub\wwwroot\test\data\';

function GetExtensionVersion( var Ver: THSE_VERSION_INFO ): BOOL; stdcall;
begin
  Ver.dwExtensionVersion := $00010000; // Version 1.0
  Ver.lpszExtensionDesc := 'blah';
  Result := True;
end;

function HttpExtensionProc( var ECB: TEXTENSION_CONTROL_BLOCK ): DWORD;
stdcall;
var
     ResStr                : string;
     StrLen                : Integer;
     rc                    : Integer;
begin
  IsMultiThread := true; // for thread-safe VCL memory management
  ECB.dwHTTPStatusCode := 200;
  ECB.lpszLogData := 'Delphi DLL Log';
  ResStr := '<HTML><body>';

  ResStr := ResStr + '<H1 ALIGN=CENTER>Hello World.</H1>';

  Sessions.OpenSession( IntToStr( GetCurrentThreadID ) );
  Sessions.CurrentSession.PrivateDir := DataDir;
  rc := 0 ;
  try
    with TDBISAMTable.create( nil ) do try
      SessionName := IntToStr( GetCurrentThreadID );
      DatabaseName := DataDir;
      TableName := 'test.dat';
      Open;
      rc := RecordCount ;
      close ;
    finally
      free ;
    end ;
  finally
                with Sessions.FindSession( IntToStr( GetCurrentThreadID ) )
do
                        close;
    ResStr := ResStr + '<p>There are '+IntToStr(rc)+' records in the table';
  end ;

  ResStr := ResStr + '</body></HTML>';
  ResStr := Format( 'HTTP/1.0 200 OK' + CR +
                    'Content-Type: text/html' + CR +
                    'Content-Length: %d' + CR +
                    'Content:' + CR + CR + '%s', [Length(ResStr), ResStr]);

  StrLen := Length(ResStr);
  ECB.WriteClient(ECB.ConnID, Pointer(ResStr), DWORD(StrLen), 0);
  Result := HSE_STATUS_SUCCESS;
end;

exports
  GetExtensionVersion,
  HttpExtensionProc;


begin
  // you could do your connection pool setup here
end.




> -----Original Message-----
> From: Gary T. Benner [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 2 April 2001 12:50
> To: Multiple recipients of list delphi
> Subject: RE: Re: [DUG]: ISAPI dlls...
> 
> 
> [Reply]
> 
> HI all,
> 
> For ISAPI stuff the best site for tutorials is 
> www.matlus.com. The guy who writes the articles is called 
> Shriv Kumar, and he's quite 
> good. Some of his articles are also on the Delphi Informant website.
> 
> Re using the TSession component, you need this when you use 
> the BDE to access the database. From experience, if you are 
> using IB as a backend, then use IBO or IBX, not the BDE. If 
> you are using local files, use TClientDatasets or other non-BDE 
> types. I believe DBISAM (?) works well.
> 
> I've been working on connection pooling techniques,and it is 
> possible, and does help manage connections well.
> 
> Kind Regards
> 
> 
> Gary
> 
> 
> 
> 
> At 12:10 on 2/04/2001 you wrote 
> 
> >To  : 
> >CC  : 
> >From: Mark Derricutt, [EMAIL PROTECTED]
> >Hey guys, I'm still trying to get this ISAPI working.  Well, 
> it works, just 
> >not under load.  Someone mentioned putting a TSession 
> component on my 
> >webmodule and use that to allow the reuse of an existing 
> connection, but 
> >no, that doesn't work, IIS just doesn't run the app at all then.
> >
> >If theres anyone here whose done alot of ISAPI stuff before, 
> are you able 
> >to lend a hand, maybe blat up a simple demo project showing 
> how I should be 
> >handling multiple threads talking t the same connection (I 
> tried putting 
> >the TDatabase in its own TDataModule but that didn't wanna 
> run either).
> >
> >*mutter*
> >
> >Any help out there?
> >
> >
> >--On Friday, March 30, 2001 12:56 PM +1200 Mark Derricutt 
> ><[EMAIL PROTECTED]> wrote:
> >
> >> What would cause the DB to no longer be connected....  mmmmm
> >
> >-- 
> >There are exceptions, I'm sure, but the Windows 2000 on-line 
> community
> >seems to have, in general, the moral and spiritual qualities of your
> >average porn site. (c) Bryan Pfaffenberger, Linux Journal, Jan 2001.
> >-------------------------------------------------------------
> --------------
> >    New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
> >                  Website: http://www.delphi.org.nz
> >To UnSub, send email to: [EMAIL PROTECTED] 
> >with body of "unsubscribe delphi"
> 
> 
> 
> ========================================================
> 
> Gary Benner   -   Software Developer                  
> [EMAIL PROTECTED]
> Corporate Software New Zealand Limited       Auckland - New Zealand
> tel: +64-9 846-6067 (24hr)   fax: +64-9 846-6152     mob: 
> (021)-966-992
> Software System Design  -  Consulting  -  Mentoring   -   
> Data Modelling
> Client Server - Delphi  -  Interbase  - Oracle - Web-based 
> Technologies
> Electronic Automation and Systems - Microcontroller Design & Software
>                                 http://www.corporate.co.nz
> 
> Ref#: 41006
> 
> 
> 
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to