Wednesday, October 1, 2008

FAQs – September 2008

Delphi Client Kits

Advantage began supporting Delphi in 1997 and released our first TDataSet Descendant with version 4.4 of Advantage Database Server. Since that time we have supported many versions of Delphi from version 3 through version 2007, with version 2009 support scheduled for this year. An early release of these components are available here. For details on supported versions take a look at this post.

Over the years the client kits have matured as the Delphi IDE has changed. With these changes it became necessary to create different install packages for the newer versions of Delphi. If you are using Delphi 6 or 7 install the Advantage TDataset Descendant. If you are using Delphi 2006 or later install the Advantage Delphi Components, which were referred to as the Advantage Data Access Components (ADAC) in the past. This install includes the TDataSet Descendant as well as the Delphi .NET Data Components.

7035 Errors

If you are using the latest version of Advantage 8.1 ( or Advantage you may be seeing several 7035 “Record not visible” in your error log. This error occurs if an application attempts to goto a record that was appended in an active transaction.

Advantage uses a Read Committed Isolation level when using transactions. Therefore only the person who added or modified the records in their transaction can see the changes. All other users cannot see the new records or changes to records until the transaction is committed. Records that have been modified within a transaction are locked until the transaction is committed or rolled back. New records are not visible until the transaction is committed and deleted if the transaction is rolled back.

This is a known issue in version and of Advantage. The error is being incorrectly logged in the error log which could negatively affect performance. This issue has been resolved in the latest versions of Advantage, upgrade to the latest version ( or There is a KB item available on this issue.

Using SQL with ACE APIs

Programmers who use Alaska XBase++ with Advantage need to use the ACE API in order to run SQL statements. ACE API calls are also used in C or C++ programs. In fact ACE is used by all 32bit Advantage clients, such as the TDataSet Descendant and .NET Data Provider.

You must use at least two API calls in order to run an SQL statement on the server. You must first create an SQL object on the server (AdsCreateSQLStatement). Next you can execute a statement directly (AdsExecuteSQLDirect)or prepare a statement (AdsPrepareSQL)and then execute the statement (AdsExecuteSQL). The following example demonstrates connecting to Advantage and then running a simple query using the ACE API.

   1: Int32 iConnHandle;
   2: Int32 iSQLHandle;
   3: Int32 iCursorHandle;
   4: Int32 iReturnVal;
   6: // Connect to the server
   7: iReturnVal = AdsConnect60('C:\Data\SampleDB\SampleDB.add',2,"Adssys",NULL, ADS_DEFAULT, &iConnHandle);
   9: // Create a SQL statement object on the server
  10: iReturnVal = AdsCreateSQLStatement(iConnHandle, iSQLHandle);
  12: // Run the SQL statement
  13: iReturnVal = AdsExecuteSQLDirect(iSQLHandle, "SELECT * FROM MyTable", &iCursorHandle);

Note: A return value other than 0 indicates an error has occurred. For brevity I did not include error checks in the sample code.

After you get a Cursor Handle back you can manipulate the results using API calls such as AdsGetString, AdsSetString, AdsSkip, etc.

Terminal Servers and Virtual Machines

Advantage runs on both terminal servers and virtual machines. Each terminal server client will be counted as an Advantage user. The management utility will list the Terminal Client Address for all users who are connected through a terminal server session. Local server cannot be used with a terminal server and will report a 5185 “Local Connection Restricted” if it is used with a terminal server.

I have use virtualization for test environments for several years. I believe that it is a fantastic test environment and allows for a lot of flexibility when recreating problems. I still favor dedicated hardware for Advantage over virtualized servers, however, as virtualization technology improves there will be very little difference for the users. As always select the environment that best supports your application and users.


unicasoft said...

Dear Chris Franz,
my program running winserver2003 and it must connect to data on local pc.
but i believed 5185 error.

can Server api connect to client data on network?

unicasoft said...
This comment has been removed by the author.
Chris Franz said...

If you are getting a 5185 error then you are probably accessing the Win2003 server through a Terminal Session or Remote Desktop (RDP) session. This is a violation of the license agreement for Local Server.
You can use local server with data shared from a Win2003 server as long as it is being accessed from another PC and not a remote session.