Subject IBO Connection Pool problems (Jason, could use your input on this)
Author mp527
Hi,
I am creating a datamodule and in the create and destroy I do the
following (see below)
I create (and freeandnil) this datamodule whenever I need to access
the FB 1.02 DB from my Indy threads. All works fine for about 3 to
5 days then I start getting ISC ERROR MESSAGE:file is not a valid
database.
When this occurs I can still connect to the DB with IB Expert and
any other admin tool, this tells me the DB is not corrupt, but the
IBO connection pool is flaking out. After we restart the server
everything is fine for a few more days.

I have tried to duplicate by stopping the FB server while my service
is running, but I can't recreate this error. It's like the
connection pool handles are having some problems.

I have to use the connection pool features or the responsivness of
my server goes down the tubes because FB 1.02 connections take so
long to create.

Any Ideas from anyone would be very helpful.
If I can't get this working I may be forced to go to FB 1.5 where
the connection slowness has been fixed.

unit ibdatamodU;

interface

uses
DB,Classes,sysutils, IB_Components, IB_Session,forms;

type
Tibdata = class(TDataModule)
IB_Session1: TIB_Session;
maintrans: TIB_Transaction;
mainconnection: TIB_Connection;
userq: TIB_Cursor;

procedure DataModuleCreate(Sender: TObject);
procedure DataModuleDestroy(Sender: TObject);
private

public
{ Public declarations }
end;

var
ibdata: Tibdata;

implementation

uses Unit1, server_moduleU, globals;

{$R *.DFM}

procedure Tibdata.DataModuleCreate(Sender: TObject);
begin
mainconnection.DatabaseName:= globals.dbpath;
mainconnection.DefaultTransaction:= maintrans;
userq.IB_Transaction:=maintrans;
mainconnection.Connect;
if mainconnection.DefaultTransaction.Started then
mainconnection.DefaultTransaction.Commit;

end;

procedure Tibdata.DataModuleDestroy(Sender: TObject);
begin
try
if mainconnection.DefaultTransaction.Started then
mainconnection.DefaultTransaction.Commit;
finally
userq.Close;
mainconnection.Disconnecttopool;
end;

end;

end.