Connection Pool is used like this ?
----------------------------------------------------------------------------------------
program api;
{$MODE DELPHI}{$H+}
uses
cthreads,
db.dataset;
begin
db.dataset.PoolConexao;
end.
----------------------------------------------------------------------------------------
unit db.dataset;
{$mode Delphi}
interface
uses
Classes,
IBC,
SysUtils;
procedure PoolConexao;
var
Conexao: TIBCConnection;
implementation
procedure PoolConexao;
begin
Conexao := TIBCConnection.Create(nil);
try
Conexao.ClientLibrary := VarPub.FBClient;
Conexao.Password := 'masterkey';
Conexao.Server := VarPub.FBServidor;
Conexao.Port := VarPub.FBPorta;
Conexao.Database := VarPub.FBBanco;
Conexao.Username := 'SYSDBA';
Conexao.LoginPrompt := False;
Conexao.Options.Charset := 'WIN1252';
Conexao.Options.UseUnicode := True;
Conexao.Pooling := True;
Conexao.PoolingOptions.MinPoolSize := 1;
Conexao.PoolingOptions.MaxPoolSize := 5;
Conexao.Options.DisconnectedMode := True;
Conexao.PoolingOptions.Validate := True;
except
//Log({$I %FILE%}, {$I %CURRENTROUTINE%}, {$I %LINE%}, LMsg, 1);
end;
end;
end.
----------------------------------------------------------------------------------------
unit proc;
procedure getEmpresas(Req: THorseRequest; Res: THorseResponse);
var
cnx: TIBCConnection;
qry: TIBCQuery;
begin
cnx := DB.dataset.conexao;
qry := DB.dataset.query(cnx, 'select * from emp order by emp_id;');
try
qry.Open;
while not qry.EOF do
begin
qry.Next;
end;
finally
qry.Free;
cnx.Close;
end;
end;
----------------------------------------------------------------------------------------