Error when connecting to Advantage Tables

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rockbone
Posts: 2
Joined: Thu 14 Mar 2013 23:11

Error when connecting to Advantage Tables

Post by rockbone » Thu 14 Mar 2013 23:17

Hi,

I'm testing UniDAC components (4.6.12 for Delphi XE - Trial Edition). The Oracle Direct mode works as a breeze, but I can't connect to Advantage tables.

I'd installed Advantage ODBC Driver 9.10.0.35 and configured a System DSN that I verified with ODBC query tool.

Any attempt to open a free table (ADT or CDX) through UniDAC component TUniQuery fails with an error.

Any clues?

Thank you in advance.

Regards,
Alvaro Dalloz
http://www.dalloz.es

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

Re: Error when connecting to Advantage Tables

Post by AlexP » Fri 15 Mar 2013 10:13

Hello,

To connect to local Advantage tables, the ServerTypes property should be set to ALS. The following sample demonstrates connecting to an ADS test database distributed along with ODBC driver

Code: Select all

var
  UniConnection: TUniConnection;
  UniQuery: TUniQuery;
begin
  UniConnection := TUniConnection.Create(nil);
  try
    UniConnection.ProviderName := 'Advantage';
    UniConnection.SpecificOptions.Values['ServerTypes'] := 'ALS';
    UniConnection.Database := 'C:\Program Files\Advantage 9.10\Help\ADS_DATA\';
    UniConnection.Connect;
    UniQuery :=  TUniQuery.Create(nil);
    try
      UniQuery.Connection := UniConnection;
      UniQuery.SQL.Text := 'select * from animals';
      UniQuery.Open;
    finally
      UniQuery.Free;
    end;
  finally
    UniConnection.Free;
  end;

end;

rockbone
Posts: 2
Joined: Thu 14 Mar 2013 23:11

Re: Error when connecting to Advantage Tables

Post by rockbone » Fri 15 Mar 2013 13:00

Hi Alex,

Thank you very much for your help!

The problem was that DSN parameters were overridden by Uniconnection properties. It was driving me crazy ...

;)

I see more clearly now ...

1. The Uniconnection.Database property must contain the ODBC connection string, including specific parameters (DefaultType required when opening free tables)

2. The UniConnection.SpecificOptions.Values['ServerTypes'] must be set to ALS

No need to configure any DSN ...

Great product Unidac. Congrats!

Kind regards,
Alvaro

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

Re: Error when connecting to Advantage Tables

Post by AlexP » Mon 18 Mar 2013 11:31

Hello,

If you want to use a set DSN, you should use ODBCUniProvider, and all the parameters, except user name and password, should be set in the DSN settings. If you use AdvantageUniProvider (without DSN), the connection parameters are set in theTUniConnection properties.

edmarfrazao
Posts: 15
Joined: Mon 23 Sep 2013 16:34

Re: Error when connecting to Advantage Tables

Post by edmarfrazao » Wed 12 Jul 2017 18:09

I had problems and I'm posting the correct solution

In the database you must pass the paramenter

UniConnection.SpecificOptions.Values['ServerTypes'] := 'ALS';
UniConnection.Database := 'C:\Program Files\Advantage 9.10\Help\ADS_DATA\ ; DefaultType=FoxPro';

or visite http://devzone.advantagedatabase.com/dz ... e_keys.htm

Post Reply