Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: Problems using VCL wrapper classes when connection fails
Problems using VCL wrapper classes when connection fails
Posted: 2005/07/14 15:26
 
Hello,

I have encountered a problem using the VCL Wrapper Classes of AnyDAC
while establishing a connection to a database (Oracle). Usually I am
able to create a working connection and I am able to tear it down
again successfully (have a look at the snippet below).

But if the call to OpenConnection() fail - e.g. 'LogOn denied' due to
wrong username and/or password - an exception is raised on freeing the
TADManager instance:

EADException '[AnyDAC}[Phys] -334 ADPhysManager shutdown timeout.
Possible reason: application has not released all connection
interfaces.'

As far as I can see the connection interface is only released if the
connection is in state "connected". But if OpenConnection() fail the
TADConnection instance never reaches this state...
Furthermore having a debugger-look on TADCustomConnection.Destroy()
reveals that the reference counter on FConnectionIntf is at least 2 in
case the OpenConnection() call failed...


Maybe I am using the Wrapper Classes in a wrong way. In this case I
would appreciate some hints... Otherwise is there a way to avoid this
problem ?

Regards

M.J

---------------------------------

// Snippet - not tested
var
ADM: TADManager;
ADC: TADConnection;
begin
ADM := TDataManager.Create(nil);
try
ADM.ConnectionDefFileName := '<existing and working ini file>';
ADM.LoadConnectionDefFile();
ADM.Open();

ADC := TADConnection.Create(nil);
try
ADC.ConnectionDefName := '<name of an existing and working
definition>';
ADM.OpenConnection(ADC);
finally
ADC.Free();
end;

finally
// here the exception mentioned above is raised if
// call to OpenConnection() failed...
ADM.Free();
end;
end;
RE: Problems using VCL wrapper classes when connection fails
Posted: 2005/07/14 16:09
 
Hi !

That is known to me issue, i will fix it.

Regards,
Dmitry