Latest UniDac error "connection is not connected"

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
badmood
Posts: 37
Joined: Thu 29 Jan 2009 23:28
Location: Italy

Latest UniDac error "connection is not connected"

Post by badmood » Mon 12 Sep 2016 13:58

Sirs,

with the latest version of uniDac, just recompiling a program that never had this issue, I have an intermittent "connection is not connected" error message closing a form. Same identical form with previous version was ok.

Database: PostgreSQL 9.5.4
Delphi 10.1 Berlin
UniDAC 6.4.14

This is the code I use on the formclose event.

Code: Select all

  for N := 0 to ComponentCount - 1 do
  begin
    C := Components[N];
    if C is TUniQuery then TUniQuery(C).Close;
  end;
Sergio.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Latest UniDac error "connection is not connected"

Post by AlexP » Mon 12 Sep 2016 14:29

Hello,

The code you have provided works without errors. Please send a complete sample to support*devart*com

badmood
Posts: 37
Joined: Thu 29 Jan 2009 23:28
Location: Italy

Re: Latest UniDac error "connection is not connected"

Post by badmood » Mon 12 Sep 2016 14:58

I know that this code works, it's there from an age...

I debugged the program, the error shows when you exit from the main form of the program:
(with DBConnection1 in connected status)

Code: Select all

  if dmMain.DBConnection1.Connected then
    dmMain.DBConnection1.Connected := False;
same if you use

Code: Select all

  if dmMain.DBConnection1.Connected then
    dmMain.DBConnection1.Disconnect;
The code is on the formclose event of the program main form.

Sorry, but right now I can't send you a sample code.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Latest UniDac error "connection is not connected"

Post by AlexP » Tue 13 Sep 2016 10:23

This code doesn't lead to the error as well. We need a complete project reproducing the issue. Please try to compose a small application demonstrating this situation and send it to us.

badmood
Posts: 37
Joined: Thu 29 Jan 2009 23:28
Location: Italy

Re: Latest UniDac error "connection is not connected"

Post by badmood » Tue 13 Sep 2016 11:45

I'm very sorry, but I can't send to you any code, because if I drop some element maybe the problem goes away and to give you something I must give to you some "patented" code and I really can't do this.

But... if the previous version never give me any error, and the latest do - only recompiling -, I can think that something have changed in your disconnection routines.
If debugging my code I see that I have an active connection an then the program execute the disconnect and I see "connection is not connected" I can only imagine that some change, maybe in your code, can lead to that message, who knows.

As a workaround I've put the lines on a try/on exception code.

Regards.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Latest UniDac error "connection is not connected"

Post by AlexP » Wed 14 Sep 2016 09:09

Unfortunately, we can't tell the exact reasons for such behavior without reproducing the problem.

Post Reply