Solved

Table is Busy !?!

Posted on 1998-12-25
13
1,557 Views
Last Modified: 2008-02-26
****
Project BatchRender.exe raised exception class EDBEngineError with message 'Table is busy. Table: C:\DATA\BATCHRENDER\SPOOL.DB User:Boons'. Process stopped.
****

This is the code I used:
----
Procedure EmptySpoolTable;
Begin
  With BatchRenderForm.TableSpool do
    Begin

   Close;
   DatabaseName:='SpoolBatchRender';
   TableName := 'spool.db';
   TableType := ttDefault;
**   DeleteTable; ** This is the line that caused the error.
      Active:=True;
   Close;

   DatabaseName := 'SpoolBatchRender';
   TableName := 'spool.db';
   TableType := ttDefault;
   CreateTable;
   Active:=True;

    end;
End;
----

How Can I Delete a database (table) at startup of my program ?
Do I miss Something ?
0
Comment
Question by:p05010
  • 6
  • 3
  • 2
  • +2
13 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1352964
hi p05010,

why don't you just use EmptyTable? Then you even don't have to create the table anymore.

Zif.
0
 
LVL 1

Expert Comment

by:slautin
ID: 1352965
1.
   DatabaseName:='SpoolBatchRender';
   TableName := 'spool.db';
   TableType := ttDefault; ttParadox - why not
   DeleteTable;
   Active:=True; ??? Why
   Close;
2. Verify next users, who use your database.
3. Use EmptyTable.
4. Use try ... except modules
5. I specially create test program like your and hasn't problems.
   For answer I must have more information.
6. Mail to me for details testing.
0
 
LVL 1

Author Comment

by:p05010
ID: 1352966
Hello Slautin, ZifNab,

I've tried different solutions, i.e. EmptyTable,
but it doesn't work, I've get always that annoying error.
This Error always appears just after the executing of DeleteTable (or Empty Table).
I've searched for older solutions mentioned at experts-exchange and I've found some related problems like mine. I'm working on a NT4 system with NO extra users. The older solutions explain that NT4 keep track of the program that's using a particular file (like a DB file). One of the solutions was to close the database or all the connections to that file. So if I do that, there's no program that uses that file at the moment.
And How can I do That ???
Look for "Paradox Table in a directory under windows NT" (answered by kretsschmar) and "Updating a Paradox record" (answered by rpetruni).
Can you give an example of How I can disconnect all the table connection with a buttonclick. Erase the database (db file) and restore the connections ?

By,
P05010
0
 
LVL 1

Author Comment

by:p05010
ID: 1352967
Can somebody send me an example program to try it on my nt4 platform ?
peter.boons@ping.be
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1352968
hi p05010,

first you should use emptytable instead deletetable, its faster than createtable after deletetable.

your problem seems that there is an connect open to your table with an other tablecomponent. Check all your tablecomponents that points to this table.

to disconnect all your tables with one statement you can use the databasecomponent. the databasename of your tablecomponents should then pointed to the databasecomponent. with the statement databasecomponentname.conntected := false all table- and querycomponents will be closed which pointed to this databasecomponent.

meikl
0
 
LVL 1

Author Comment

by:p05010
ID: 1352969
Kretzschmar,

I've used your solution and but it didn't work directly.
I've used the following code.

Procedure EmptySpoolTable;
var DatabaseNaam:Tdatabase;
Begin
  With BatchRenderForm.TableSpool do
    Begin

      Active:=False;
      BatchRenderForm.DataBaseBRSpool.Connected:=False;
      EmptyTable;
      BatchRenderForm.DataBaseBRSpool.Connected:=True;
      Active:=True;

    end;
End;

I can only test this when delphi is closed and when I've run the program from the explorer. That's the only way the program empties the table and that it not post an error on the screen. It seems that the Delphi environment has an instance to that .DB file and NT recognize this like a file that's curently open by another program. SO that little thing is BUSY at the moment.
I even tried it with HandleShared property set to yes.
Who from you guys is also developping delphi applications under NT ? Do you experience the same problems ?

Now I've one big problem, I cannot put the above source in the Oncreateform event so that the database is emptied every time you start the program (under the delphi environment I mean).

Help !
p05010

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 1352970
ok p05010,

i think i see your problem, its no problem of NT, i've the same under win95.

in designmode all tables should be closed. in the oncreate-event of your form open the table and empty it.

example

procedure TForm1.FormCreate(Sender: TObject);
begin
  table1.open;
  table1.EmptyTable;
end;


meikl

0
 
LVL 1

Author Comment

by:p05010
ID: 1352971
Hello kretzschmar,

I've just want to mail that I've found the solution you described above. I've set the table.active to false in designtime and the database connoection to false.
In the form's oncreate handler I've put the following code:
  BatchRenderForm.DataBaseBRSpool.Connected:=True;
  BatchRenderForm.TableSpool.Active:=True;

And yes it works.
Hey, many thks for the good ideas.
Please answer the question ...
Bye,
P05010
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1352972
Before deleting a table do the following:
1. Verify that the table is not opened in another application.
2. Close the Table and write:  Table1.Exclusive:=True;
If this doesn't help then:
1. Verfiy that you are disconnected from the database.
2. Delete the file  Pdoxusrs.net
   This file will be recreated automatically by the BDE when it's needed.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 1352973
hi p05010,

i wish you good luck for your project and

of course

a happy new year

meikl
0
 
LVL 1

Author Comment

by:p05010
ID: 1352974
A happy new year to you all.

Bye
0
 
LVL 1

Expert Comment

by:slautin
ID: 1352975
//I test this module by D2.0. - all right !

Procedure EmptySpoolTable;   // read everythings about OOP, OOD!
                             // (G.Booch for example ).
                             // it must be class method !
var DatabaseNaam:Tdatabase;  // becouse you use class property -
                             //TableSpool
                             // it's as ABC of OO Languages
Begin
  With BatchRenderForm.TableSpool do
    Begin

   // My recomendations:
   // use fields and columns editor for TableSpool
   // be carifully in coding... where your comments? :-)

   if not Active then
       Open; // for columns set
             // if you use fields and columns editor for
             //TableSpool
             // don't call this method !
   Close;
   //DatabaseName:='SpoolBatchRender'; - not requered
   //                                    it's allready present
   //TableName := 'spool.db';
   //TableType := ttParadox;
   EmptyTable;

   {OpenDatabase(BatchRenderForm.DatabaseSpool);}
   //DatabaseName := 'SpoolBatchRender';
   //TableName := 'spool.db';
   //TableType := ttDefault;
   Open;
   //Active:=True;

    end;
End;
0
 
LVL 1

Author Comment

by:p05010
ID: 1352976
Thx for the mail Slautin.

Bye,
P05010
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now