we migrated from ADO to SDAC. The next step for us was to enable connection pooling from SDAC. To get rid of connections to a database we want to delete we call TMSConnectionPoolManager.Clear. In some cases we get an access violation when we close a query afterwards. The pooling causes the connection to be put back into the pool which was freed before. Following an example to replicate the issue:
Code: Select all
var
  con: TMSConnection;
  qry: TMSQuery;
begin
  CoInitialize(nil);
  con := TMSConnection.Create(nil);
  con.ConnectString := 'Data Source=TEST;Initial Catalog=TEST;Authentication=Windows';
  con.Pooling := True;
  qry := TMSQuery.Create(nil);
  try
    qry.Connection := con;
    qry.SQL.Text := 'SELECT 1';
    qry.Open;
    TMSConnectionPoolManager.Clear;
    qry.Close;
  finally
    qry.Free;
    con.Free; // here access violation
  end;Best regards