Solved

PARADOX PROBLEMS

Posted on 1998-12-16
19
1,075 Views
Last Modified: 2008-02-26
This will have to be a good answer.  I really need help here.  I have written a program which uses Paradox databases and Delphi 4.02.  My problem is that the program seems to crash every now and then and corrupts one of the databases.  When my customer tries to reopen the program, it tells her she cant because the table has a corrupt index.

Is there something I can do to which prevents index corruption?  I havent seen the problem with any other databases, and it really ****s me cause I get called out at all times of the day to fix it.

Basically, what I want something which will repair the tables, a utility or something.  It has to work, and work well.  Ideally. I would prefer something which prevent Paradox from f&&king its self.

I really need this answered quickly and accurately.  If I havent recieved an answer soon, Im going to try Access.  Even though its slower, it will just have to do.

Thanks in advance.

Stuart.
0
Comment
Question by:Stuart_Johnson
  • 6
  • 4
  • 3
  • +4
19 Comments
 
LVL 4

Expert Comment

by:dwwang
Comment Utility
Have you tried to upgrade to BDE 5.01?
0
 
LVL 6

Author Comment

by:Stuart_Johnson
Comment Utility
Done that too :(  It made no difference.
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
hi Stuart Johnson,

the index will be currupted because your program ends abnormaly, and leave the indexfile open, and in a inconsistant state. The solution is to make your program stable, and to find out about your program crashes. A interim-solution is to delete the indexfile via filesystem and recreate new. Maybe the newest BDE Version helps.

meikl
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 200 total points
Comment Utility
To repair the indexes activate the SQL command: DROP INDEX... and then: CREATE INDEX...
Also you can download a Repair Utility from Borland:
http://www.borland.com/devsupport/bde/utilities.html#32Utility
Download these files:
http://www.borland.com/devsupport/bde/files/pxrest.zip
http://www.borland.com/devsupport/bde/files/tutil50.zip
If you want the source code, download this file:
http://www.borland.com/devsupport/bde/files/tutil32d_package.zip
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
hi ronit,

the SQL-Statement cannot be used, because the table cannot be opened with a corrupted index to retrieve the indexname, i recommend to delete the index via filesystem and recreate new, but this is only a interim-solution because it is a reaction of the problem and not solving of the cause.

meikl
0
 
LVL 4

Expert Comment

by:dwwang
Comment Utility
Hi, Stuart Johnson

If you only want to solve the problem of deleteing and recreating the index , I have fully working code for that.
0
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
kretzschmar,
If the indexes are permanent, meaning they are not changed by the user, then he knows the structure and name of the indexes, therefore there is no need to open the table, just
Activate the SQL and exeute it. But Borland already have their solution, so I think it's better to use their way by calling tutility.dll .This file is free to use. Stuart Johnson, Download it and other supportive files from:
http://www.inprise.com/devsupport/bde/files/utlapi.zip
0
 
LVL 6

Author Comment

by:Stuart_Johnson
Comment Utility
Hi Guys,

I have downloaded the utilities mentioned by ronit.  The Table Repair utility seemed to work, although I havent been able to test it on my clients data yet.

Does anyone know of any documentation for the tutil32 DLL?  I think that maybe I could just write a simple wrapper for it which repaired all the databases without any user intervention.  I know there is an example using the tutil32.dll, but I would actually like to know what it does completely before I make a descision on whether or not to use it.

Thanks for your help so far.

Stu.
0
 
LVL 1

Expert Comment

by:venks
Comment Utility
Dear Stuart
I am sending you the help file of a component that i use.It is freeware and works very well for me.It is Ttable descendant
and takes care of bad data and corrupted indexes.
I think i downloade it form Torry's or delphi super page

regards
venks

TMBTable:

If you have used Paradox tables in your development, you may have run into the problem with data not getting posted, or indexes getting corrupted.

The way to fix this is to put "DbiProcs" in the USES clause of the Form or DataModule containing your TTable, and then calling "dbiSaveChanges" in the AfterPost event.

While this works well, it is a pain to do for every table, and you also have to remember to do it everytime!

TMBTable is derived from TTable, and automatically does all the above for you. Other than this addition, it is identical to the normal TTable. It is distributed with full source code so it should work with D2 and D3 - maybe even D1 but I'm not sure.

Please email me if you have any comments or questions.

Matthew J. Brock
Computer Solutions:AZ
Tucson, AZ

email: mjb@azstarnet.com

NOTICE: This is distributed as freeware with no restrictions. You can use it in any type of application, even commercial. All I ask is you let me know how you like it, and give me any ideas or suggestions you have!

INSTALLATION:
-------------
1. Copy MBTable.pas and MBTable.dcr to your LIB directory, or the directory where you keep all your components.
2. From the Component option in the Delphi menu, select Install Component.
3. Navigate to the directory where you copied the file and select the MBTable.pas file.
4. Click OK, and then rebuild the library.
5. The component will be installed on a new tab in your palette called "CSA". You may move it to any tab you wish.
6. Drag and Drop! :)
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 6

Author Comment

by:Stuart_Johnson
Comment Utility
Matthew,

I just sent you an email.  If you can forward the component onto me, I'll work out how well it goes for me.  

My program only uses 7 databases, and they are only opened once, so using the component wont be a problem.

Thanks very much.

Stuart.
0
 

Expert Comment

by:dejohn99
Comment Utility
1. The TUtility source code is available in Delphi 3 and 4 from Borland's web page.  There is also a help file and documentation which describe it.

2. Paradox is periodically subject to this sort of corruption even with a stable program.  It has been an issue with the Paradox architecture since its inception, and is probably a fundamental design flaw.  That is why Paradox has always been bundled with TUtility.  Putting dbeSaveChanges minimizes at key points this issue, but does not entirely eliminate it.

3. Definitely find out why your app is crashing.  A crash is a serious problem with unpredictable outcomes on a complex OS such as any flavour of Windows.

4. To make the application more reliable, slip into client server mode and use local Interbase as a back end.  In some respects it is more restrictive than Paradox, but it manages larger databases more efficiently.  Also, if your application crashes the back end service still operates and manages whatever data it has received.  In the case of a faulty transaction, the entire transaction is automatically rolled back to its last valid state prior to the crash.
0
 
LVL 6

Author Comment

by:Stuart_Johnson
Comment Utility
I should probably explain about the crashes.  My client runs a number of programs simultaneously - mainly accounting programs.  Quite a while back, her PC locked up while my program was running.  

The cause of the lock up we think was her accounting program (which used to do it quite frequently before my program was even installed).

Now, when ever she attempts to open some of the records, the program locks up.  Its not that something is wrong with the code or anything, its just that the tables are corrupt.

I have since fixed them with the program mentioned by Ronit, and I have emailed her a copy of the repaired databases and all things are working perfectly.

I now want to keep it that way.  Even if she crashes her computer again.  I am waiting for a reply from Matthew to see if his component fixes our problem.

dejohn99: You mentioned something about Interbase.  I was under the impression that I was not allowed to distribute Interbase without a license.  I was told that at a recent course I attended with Inprise here in Sydney (Australia).  Is this true, or am I being led astray?

Stuart.
0
 

Expert Comment

by:dejohn99
Comment Utility
That is true.  But Interbase licenses are not that expensive.

Unless she is using Windows NT, Interbase won't fix this problem - a program lockup is a program lockup - unless you put her datastore on a physically separate machine.
0
 
LVL 6

Author Comment

by:Stuart_Johnson
Comment Utility
No, she isnt using NT.  Its 95 with IE 4 (I know, thats where the problem is <G>).

Unfortunately, if I upgrade her to IB, its going to cost me.  I've already quoted her and I dont want to pay up for something that really shouldnt be required.

Stu.
0
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
Stuart, for the DLL Documentation download:
http://www.inprise.com/devsupport/bde/files/utlapi.zip
0
 

Expert Comment

by:dejohn99
Comment Utility
The issue here is not that your program fails, but that her environment is unstable, and that renders anything you can do unstable as well.  If you can't trust your OS, you can't trust anything.  

Interbase won't help you under Win95 without a separate machine on a LAN, so there's no point in going that route.  Place a dbiSaveChanges at regular intervals in your app as suggested above.  This will minimize the chances of corruption as much as possible.

In addition, write a registry value to indicate when the program was terminated abnormally.  When you start up test the variable and if it is not 0 then caution the user to repair their tables before proceeding.  (I have lost a lot of data by opening a corrupted Paradox table!)  Otherwise, set it to 1 and then later when you exit the application set it to 0 again.
0
 
LVL 6

Author Comment

by:Stuart_Johnson
Comment Utility
It appears that the TUtility program fixed the problem.  I have now incorperated that into the program so each time the app is run the tables are checked and fixed if required.

The program hasnt crashed since running this utility, so I presume that the cause of the crashes were due to data corruption.

Thanks to all who posted comments and suggestions.  Your help is greatly appreciated!!

Regards,


Stuart.
0
 
LVL 1

Expert Comment

by:slautin
Comment Utility
I offer meeting with this problems and can recommend you:
1. Don't create primary index, only secondary (my be unique).
2. Don't terminate application abnormally.
3. I have working project which will repair the paradox tables.
If you need it send me message by mail: slautin@yahoo.com.

0
 

Expert Comment

by:dejohn99
Comment Utility
You can't create a secondary index in paradox without first creating a primary index.  This is one of the defining points of the Paradox model.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
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…

743 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

14 Experts available now in Live!

Get 1:1 Help Now