TADoConnection and Association

I am working on an entire application that uses multiple threads that access sql server 2005 db, currently I am using implicit connections by setting the connection string property of the TADOQuery object, but it seems to open up a lot of database connections. We need to reduce the number of connections opened by one instance, so

  • Is there any connection pool available in the tadoconnection library, and how can I enable it and set its limits.
  • If not, what is the recommended way to reduce and reuse database connections so that the application scales well.

I would appreciate any opinions or thoughts.

many thanks

+3
source share
4

ADO SQL Server - , . . ?

/ ADO ADO runtime . "" .

+3

- , .

, ,

db := TAdoConnection.Create()
qry1 := TAdoQuery.Create();
qry2 := TAdoQuery.Create();

qry1.connection := db;
qry2.connection := db;

qry1.SQL.Text := 'select * from whatever';

qry1.open;
while not qry1.eof do
begin
  x := qry1.fieldbyname('fld').AsString;
  qry2.SQL.Text := 'select * from elsewhere where SomeField='+ QuotedStr(x);
  qry2.Open;
  ..do something..
  qry2.Close;

  qry1.Next;
end;

qry2.Open() ,

, qry1 , qry2. .

:

db := TAdoConnection.Create()
qry1 := TAdoQuery.Create();
qry2 := TAdoQuery.Create();
str := TStringList.Create();

qry1.connection := db;
qry2.connection := db;

qry1.SQL.Text := 'select * from whatever';

qry1.open;
while not qry1.eof do
begin
  x := qry1.fieldbyname('fld').AsString;
  str.Add(x);
  qry1.Next;
end;
qry1.Close;

for i := 0 to str.Count-1 do
begin
  qry2.SQL.Text := 'select * from elsewhere where SomeField='+ QuotedStr(str[i]);
  qry2.Open;
  ..do something..
  qry2.Close;
end
+4

TADOConnection DataModule ADO datamodule . datamodules, , datamodules .

+1

Microsoft : "... OLE DB, ADO ... , " OLE DB Services = -2 " ADO Connection".

: http://support.microsoft.com/kb/229564

, .

+1

Source: https://habr.com/ru/post/1708574/


All Articles