TAdoQuery not closing the connection ?



Hi all.

I have this kind of code all over an application I have to take over:

procedure TStuff.Open;
begin
  if not Assigned(ADOQuery) then
    ADOQuery := TADOQuery.Create(nil);

  ADOQuery.ConnectionString := sConnectionString;
  ADOQuery.SQL.Text := sSQLQuery;
  ADOQuery.Prepared := true;
  ADOQuery.Open;
  ADOQuery.First;
end;

procedure TStuff.Close;
begin
  ADOQuery.Close;
  FreeAndNil(ADOQuery);
end;

And other methods using the ADOQuery object.
Then if I do this:

aStuff.Open;
aStuff.GetResult;
aStuff.Close;

the connecton to the Oracle is not released. I use Toad, and I still see it, and some of our users complain that this "kills" their database as we can have up to 16 connections per instance of the application.

I know it would be better to use a TADOConnection object shared by all the TADOQuery, but that is not feasible in the delay given to me (and partly because all this is scattered accross COM objects).

How then can I close those connections?
Thanks a lot for your help

Olivier
.



Relevant Pages

  • Re: Effect of listener on existing connections?
    ... Oracle support is not giving us satisfactory results. ... and attempts to create new connections are ... We also see these messages appearing with regularity in our listener ... how does a blocked listener explain the fact that apps with existing ...
    (comp.databases.oracle.server)
  • Re: Multiple Oracle clients in same code - no usernames needed
    ... You might get away with this with an 9 client and if memory serves me ... In all cases the connections have to 'external' - No name or password ... The mechanism changed to the Oracle wallet in 10 for external ... the 2 oracle client libs will export a lot of the same ...
    (perl.dbi.users)
  • Re: Multiple Oracle clients in same code - no usernames needed
    ... You might get away with this with an 9 client and if memory serves me correctly it can connect both wallet and the old 8 way ... In all cases the connections have to 'external' - No name or password ... The mechanism changed to the Oracle wallet in 10 for external ... the 2 oracle client libs will export a lot of the same ...
    (perl.dbi.users)
  • Re: Effect of listener on existing connections?
    ... Solaris 10 inside a ZFS zone (our previous system was Oracle ... and attempts to create new connections are ... issue of the listener locking up if you're not using ONS. ... how does a blocked listener explain the fact that apps with existing ...
    (comp.databases.oracle.server)
  • Connection delays causing problems.
    ... ORACLE connections sometimes take tens of seconds to come ... This is true whether the connection is via sqlplus, ACCELL ... Over 150 clients running ACCELL applications. ...
    (comp.databases.oracle.server)