Recent

Author Topic: Tdbf and network :(  (Read 7090 times)

Fossy

  • New Member
  • *
  • Posts: 22
Tdbf and network :(
« on: December 07, 2005, 07:19:53 am »
Hello:

I'm using Tdbf (Dbase III, level 3) with exclusive=false property, but when I access to DBF in the network, the application says "Exclusive access is required for this operation" and exit.

In local mode (for test the same), I run the application and runs perfectly, but when I run other instance of the same application, I get the same error.

Why?...

Tdbf is not prepared for run in shared mode?, or I'm making something bad?.

Thanks!!!

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: Tdbf and network :(
« Reply #1 on: December 07, 2005, 01:09:57 pm »
DBase III is a very old technique and you should not want to use this. It doesnot allow you to share a file. I think you are better of using something like mySQL, Firebird or SQLite.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Fossy

  • New Member
  • *
  • Posts: 22
Tdbf and network :(
« Reply #2 on: December 07, 2005, 09:27:08 pm »
Here is the error:

    socios.FilePathfull:='c:\tecnoasociacion\datos\';
    socios.active:=true;
    socios.AddIndex('socnum.ndx','N_SOCIO', [ixPrimary]);
    socios.OpenIndexFile('socnum.ndx');
    socios.IndexFieldNames:='N_SOCIO';  

When there one application running with database opened, when we open a new instance of the same application, this ocurrs (debuging):

    socios.FilePathfull:='c:\tecnoasociacion\datos\'; ->OK
    socios.active:=true; -> OK
    socios.AddIndex('socnum.ndx','N_SOCIO', [ixPrimary]); -> FAIL!!!

Message error: "Exclusive access is required for this operation".

Ok..., then I write the next source code in order to open the index file in exclusive mode, but then turn exclusive mode to false for open other instance application:

    socios.FilePathfull:='c:\tecnoasociacion\datos\';
    socios.active:=true;
    socios.exclusive:=true;
    socios.AddIndex('socnum.ndx','N_SOCIO', [ixPrimary]);
    socios.exclusive:=false;
    socios.OpenIndexFile('socnum.ndx');
    socios.IndexFieldNames:='N_SOCIO';  

This is the result debugging:

    socios.FilePathfull:='c:\tecnoasociacion\datos\'; -> OK
    socios.active:=true; -> OK
    socios.exclusive:=true; -> OK
    socios.AddIndex('socnum.ndx','N_SOCIO', [ixPrimary]); ->FAIL!!!!

And I get the same message error.

If I write source code only for open the DBF file (without indexes), the application running PERFECTLY! in network with database shared.

Is this a bug?, or there any other form for open indexes without that error?.

Thanks!!

matthijs

  • Hero Member
  • *****
  • Posts: 537
Tdbf and network :(
« Reply #3 on: December 08, 2005, 09:02:17 am »
Have you tried setting exclusive before opening the table? Sharing a database and opening it exclusive are things which are not compatible. It looks like you need to have a table opened exclusive before you can use an index. As one user most probably needs another index then the next user, it makes DBIII not suitable for the job.
If you were using Delphi I would advise you to use clientdataset, because they have their own sorting and indexing functionality, so you will not need the DBIII index-files. I do not know if the clientdataset has already been implemented for lazarus.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Fossy

  • New Member
  • *
  • Posts: 22
Tdbf and network :(
« Reply #4 on: December 09, 2005, 03:51:25 am »
Hello matthijs:

Thanks for your reply.

My application is now full working in network with Dbase III files. The problem was in the AddIndex (is for add/create new indexes what not exists), then, only is needed to open the index files (without add):

socios.FilePathfull:='c:\tecnoasociacion\datos\';
socios.active:=true;
socios.OpenIndexFile('socnum.ndx');
socios.IndexName:='socnum.ndx'; -> Set index by name file

And you can work in network with all application instances what you need :).

The problem is what not there any manual of TDBF. I only guides by short manual stored in WIKI and I was confused with AddIndex, but DBF files is very very robust databases for working in network (of all life).

 

TinyPortal © 2005-2018