Главная страница | назад

Article #25774: I am getting permission denied errors when I run a Delphi or C++ Builder data-aware application.

The errors are:
Cannot find file e:temppdoxusers.lck
Permission Denied

In some sequences of events BDE will store data in temporary Paradox
tables. Some of the scenarios where BDE creates temporary Paradox tables
are with heterogeneous joins, and with CachedUpdates. BDE will look to
where the Paradox PrivateDir is set to be. This will be based on the
drive and directory that the application is launched from. If the
application is launched from a networked or mapped drive then the
temporary Paradox tables will be created on that drive and network
rights will be an issue. In most cases it will be sufficient to route
the Paradox PrivateDir setting to the local drive. The code snippets
below show two possible approaches to doing this in Delphi. These
approaches require the use of the Session object, specifically the
Session.PrivateDir member of the object. This also requires having
DBTables in the Uses clause. One approach is to reassign the
Session.PrivateDir to the Windows temporary directory, by calling the
GetTempPath() Windows API function call. Add Windows to the Uses clause
so that GetTempPath() can be called. The other approach is to assign a
hard coded path to Session.PrivateDir.

Uses Windows, DBTables

  temp_path_len = 512;
  temp_path: array[1 .. 512] of char;

  // Place this code snippet at the
  // approriate place in the code
  GetTempPath(temp_path_len, @temp_path);
  Session.PrivateDir := StrPas(@temp_path);

  // or
  // Session.PrivateDir := 'C:Temp';

Last Modified: 26-SEP-00