3

I'm writing an application that has to open a preexisting BDE database that has been saved by a third party.

In this application, I currently have a TDatabase (DriverName: STANDARD) with path set correctly in Params.
I can now set Connected to true without an error message.

There is also a TTable with DatabaseName set to the values of the TDatabase and TableName set to the .db-file that lies in the folder (the name was automatically filled in, I only hat to select it).

Now the problem:
If I set Active to true, an error message complains about missing access rights for C:\PDOXUSRS.NET.
I know I could set another path using BDEADMIN, but I need to solve this in my application - I can't expect every customer to do this change. Furthermore, I have a test machine with the third party application running - it can access the database without any error, while my application throws the aforementioned error. This leads me to the suspicion there might be a workaround.

Is there such a workaround?
I only need read access to the database.

Imanuel
  • 3,596
  • 4
  • 24
  • 46
  • 2
    you might try to change it programmatically http://edn.embarcadero.com/article/23231 – bummi Jun 04 '13 at 10:51
  • 1
    If all else fails, you could try to skip the BDE and access the Paradox tables through a dbExpress ODBC driver, like this one: https://sourceforge.net/projects/open-dbexpress/ – Jan Doggen Jun 04 '13 at 11:02
  • Are you running Windows 7? You probably can't access the root of C:. Try changing the directory of the net file to a directory under your user name. You should be able to do this with a program called BDEAdmin. – No'am Newman Jun 04 '13 at 11:03
  • The best option is to change database access layer from BDE to built-in Microsoft ODBC driver for Paradox tables. BDE requires separate drivers delivery and installation. You likely get more questions from customers about this process than about changing `pdoxusrs.net` directory path. – ThinkJet Jun 04 '13 at 11:24
  • How to connect to Paradox db on the flight with ODBC and specify custom network directory: http://www.carlprothman.net/Default.aspx?tabid=90#ODBCDriverForParadox or http://docs.30c.org/conn/paradox.html#microsoft-paradox-driver-odbc – ThinkJet Jun 04 '13 at 11:36

1 Answers1

5

Solved it thanks to the link of bummi
Thank you very much.

Quote:

How to change NET DIR programmatically so it persists
[...]
You should also remember that if you have programs that change their own NET DIR locations at runtime, using either the DbiSetProp function or the NetFileDir property of a TSession component, this will override the NET DIR value in the configuration file.

It pointed me to the possibility of changing the NET DIR in code:

Session.NetFileDir := MyCustomTempDir;

After doing that, Table1.active := true works and the data shows up in a connected TDBGrid.

Imanuel
  • 3,596
  • 4
  • 24
  • 46