Strange exception when calling TSQLConnection.Open;

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
Wodzu
Posts: 23
Joined: Thu 01 Sep 2011 08:35

Strange exception when calling TSQLConnection.Open;

Post by Wodzu » Thu 22 Sep 2016 06:17

Delphi Berlin 10.1 (no Update 1) 32 bit.
dbexpida40.dll 4.8.12

Hi,

this code raises a strange exception:

Code: Select all

procedure TForm1.Button6Click(Sender: TObject);
var
  oDBX: TSQLConnection;
  _params: TStringList;
  i: Integer;
begin
  _params := TStringList.Create;
  _params.Add('Storage=Native');
  _params.Add('Dialect=INTERBASE');
  _params.Add('LoginPrompt=0');
  _params.Add('DriverName=DevartInterBase');
  _params.Add('GetDriverFunc=getSQLDriverINTERBASE');
  _params.Add('VendorLib=fbclient.dll');
  _params.Add('LibraryName=dbexpida40.dll');
  _params.Add('DATABASE=C:\MYDB.FDB'); //Set up this parameter
  _params.Add('USER_NAME=SYSDBA');     //Set up this parameter
  _params.Add('PASSWORD=password');    //Set up this parameter

  oDBX := TSQLConnection.Create( nil );

  oDBX.DriverName    := 'DevartInterBase'     ;
  oDBX.GetDriverFunc := 'getSQLDriverINTERBASE' ;
  oDBX.VendorLib     := 'fbclient.dll'      ;
  oDBX.LibraryName   := 'dbexpida40.dll'    ;
  oDBX.LoginPrompt   := False    ;
  for i:=0 to _params.Count - 1 do
  begin
    oDBX.Params.Values[ _params.Names[i] ] :=
      _params.Values[ _params.Names[i] ] ;
  end;
  oDBX.Open; //Exception raised here with corrupted message.
end;

However the same code is working on Delphi 2009 without problems. Could you please check the issue? We are unable to provide new version of our application because of this error.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Strange exception when calling TSQLConnection.Open;

Post by ViktorV » Thu 22 Sep 2016 12:16

Thank you for the information. We have reproduced the issue and investigation is in progress. We will inform you when we have any results.
Currently, to solve the issue, please comment out the following line in your sample:

Code: Select all

  _params.Add('GetDriverFunc=getSQLDriverINTERBASE');
since you are setting a similar value for the TSQLConnection.GetDriverFunc property further in the code:

Code: Select all

oDBX.GetDriverFunc := 'getSQLDriverINTERBASE' ;

Wodzu
Posts: 23
Joined: Thu 01 Sep 2011 08:35

Re: Strange exception when calling TSQLConnection.Open;

Post by Wodzu » Thu 22 Sep 2016 12:21

Thank you Victor.

The code which I presented might be a bit strange, but this is due to fact that I've extracted it from 3rd party component which uses dbx internally.

I hope you will be able to fix the issue so I would not have to change the code in the component.

Best regards.

Wodzu
Posts: 23
Joined: Thu 01 Sep 2011 08:35

Re: Strange exception when calling TSQLConnection.Open;

Post by Wodzu » Wed 28 Sep 2016 16:24

Guys,

do you have any news when the fix will be applied? We are blocked with release of our software by this.

Regards,

Wodzu

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Strange exception when calling TSQLConnection.Open;

Post by ViktorV » Fri 21 Oct 2016 11:17

This issue concerns only how early versions of Delphi work with dbExpress-drivers, and we cannot change this behavior.
GetDriverFunc is the name of a function in the dbExpress driver library specified by the LibraryName property. The name of the function has to be specified in its original name, with the same spelling and case as it declared in the driver library.
To solve the problem, please specify the name as getSQLDriverInterBase, instead of getSQLDriverINTERBASE. For example:

Code: Select all

_params.Add('GetDriverFunc=getSQLDriverInterBase');

Wodzu
Posts: 23
Joined: Thu 01 Sep 2011 08:35

Re: Strange exception when calling TSQLConnection.Open;

Post by Wodzu » Fri 21 Oct 2016 11:51

ViktorV wrote:This issue concerns only how early versions of Delphi work with dbExpress-drivers, and we cannot change this behavior.
But I got this error on Delphi 10.1 so on the newest version.
ViktorV wrote:To solve the problem, please specify the name as getSQLDriverInterBase, instead of getSQLDriverINTERBASE.
I understand that you can't fix the issue if it is beyond the scope of your component. However, what about the exception? Currently the exception message is unreadable, it does not say anything about the error.

Could you fix that so exception would be readable? If not, could you report the error to the Embarcadero?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Strange exception when calling TSQLConnection.Open;

Post by ViktorV » Fri 21 Oct 2016 13:43

When we said "This issue concerns only how early versions of Delphi work with dbExpress-drivers, and we can not change this behavior", we meant that this problem did not occur in the early versions of Delphi.
Could you fix that so exception would be readable? If not, could you report the error to the Embarcadero?
It seems that Embarcadero has changed this behavior. Both on RAD 10.1 Berlin 24.0.22858.6822 and RAD 10.1 Berlin 24.0.24468.8770 (Update 1), we received a meaningful error "DBX Error: Not supported", in contrast to RAD Studio 10 Seattle 23.0.21418.420.

Post Reply