Board index » delphi » Lock files on a read-only drive

Lock files on a read-only drive

We've developed an application to use a database which resides on a Cd.
It's a delphi 1.0 application using a Paradox 5.0 Database.

No problems whatso-ever.

Now, we'd like to put the database on a network server.
De cd now resides on a server.
The client-side mounts a drive letter to the cd, and this should work right?
Wrong. Paradox is now trying to place a lock-file on the Cd.
Somehow it didn't find this nessecary when working local, but now that it's
working on a network it want to place lock-files.
Good initiative! But not on the CD!

Is there any way in which we can direct Paradox to put it's lock-files  in a
different directory?
The .Net file is placed correctly on a network drive (not the cd).
The .Lck files however cannot be created.

Any help will be appriciated.

D. van Rietschoten
The cold but beautifull Netherlands
VanRietscho...@fel.tno.nl

 

Re:Lock files on a read-only drive


On 29 Jul 1997 16:22:16 GMT, dv...@fel.tno.nl (Van Rietschoten) wrote:

Quote
>Is there any way in which we can direct Paradox to put it's lock-files  in a
>different directory?
>The .Net file is placed correctly on a network drive (not the cd).
>The .Lck files however cannot be created.

When does it try to create the .Lck files?  Does it create them if you
open the tables as Read Only?  I can't imagine what it tries to
lock...

Chuck Gadd
Director of Software Development, {*word*104} FX Communications.
e-mail:cgadd-NOS...@{*word*104}-fx.com  http://www.csd.net/~cgadd
Remove the -NOSPAM from my email address to send me e-mail.
*** I boycott businesses that send me unsolicited email adverti{*word*224}ts ***

Re:Lock files on a read-only drive


In article <33e4a87d.111066...@news.csd.net>, cgadd-NOS...@{*word*104}-fx.com
says...

Quote

>On 29 Jul 1997 16:22:16 GMT, dv...@fel.tno.nl (Van Rietschoten) wrote:

>>Is there any way in which we can direct Paradox to put it's lock-files  in a
>>different directory?
>>The .Net file is placed correctly on a network drive (not the cd).
>>The .Lck files however cannot be created.

>When does it try to create the .Lck files?  Does it create them if you
>open the tables as Read Only?  I can't imagine what it tries to
>lock...

Yes, it will create lock files even when opening a table read-only
(non-exclusive).
This makes sense too. It must be able to deny a exclusive lock from another
user. So it has to know if the file is opened.
In this case, locking makes no sense. The data is read-only.
But still it will try to create the lock file. An exeption is the result.

Greetings,

D. Van Rietschoten
The cold but beautifull Netherlands

Re:Lock files on a read-only drive


Here is some stuff (below) I got in response to same question and it helped me
solve it.
The bottom line is to use setdirlock() from paradox to control where lockfiles
files are created. In first instance be a user that has read/write to the
directory you point lock files to and open datafiles - this will cause lock
files to be created.
Subsequent regular users (who don't have read/write to directory where lock
files are and (ofcourse) can't read/write to CD ROM where data files are) open
files for readonly...paradox detects that lockfiles already exists so doesn't
try creating them and because you open files for readonly there is not
requirement to write to lockfiles....

Hope this helps.

Andy Crutchlow
andy.crutch...@service.britgas.co.uk

Steve Green - Diamond software Group - Waldorf Maryland USA
CIS:71333.2...@compuserve.com - A member of Borland's TeamB
and Corel's CTech tech support staffs but I don't represent
Borland International or Corel in any official capacity.

There is, I believe, a TI on this subject at Borland's web-site, discussing
the problems of "Paradox tables on CD-ROM ..."

In order to access tables, Paradox needs to write/update/delete those two .lck
files. These files are part of the way the BDE controls concurrency. You can
neither
stop the files from being created nor control their location.

However, Paradox (the RDBMS) has a command to create those two lock files in a
directory that is to be read-only. Note: this means the directory is read-only
for
_all_ users; you cannot have a mix at the network access level. The command in
Paradox for Windows is setDirLock(). If you have PdoxWin, try using this
command
(as someone who has read/write access to the directory).

Otherwise, try running your Delphi app with read/write access so it can create
the
two .lck files. Then close the app. The .lck files should get deleted, but you
should be able to use salvage or some other undelete utility to recover those
lck
files. Then make the directory read-only and see if it works. (I haven't tried
it
this way, so I'm just guessing.)

There might be a better 'Delphi' way, but I'm not familiar enough with Delphi
to
know. You could try the Delphi newsgroup under forums.borland.com.

Other Threads