Recent

Author Topic: Unable to get IBX to Mend or Validate Firebird DB using TIBValidation Service  (Read 4241 times)

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
Platform: Lazarus 1.8.1 (Fixed), FBC 3.0.5, Firebird Express for Lazarus 2.1.0, Windows Server Essentials 2016.

Goal:  To make a small database management utility that can do the same tasks as gfix, gbak, gesc, but with a GUI interface.

Current problem: Unable to get TIBValidation Service to mend or validate.

I have looked at the IBX example for Services and I cannot get get mine to work the way the example does. 

Here is the current status:

I have a TComboBox that allows the user to select the function they want to perform.  Then I have two check boxes, one is "Include Checksums", the other checkbox is "Check only, do not fix".  Finally, I have a TRadioGroup "Validation Scope" with two choices  "Pages Only" or "Records and Pages".  All of these are built by combining the options available in gfix and viewing the IBX example.

Here are the results:

Sweep: (works)
When I try to do a Mend or a Validate I get the error message:

[Debugger Exception Notification]

Project MyProject raised exception class 'EIBInterBaseError' with message:
bad parameters on attach or create database
secondary server attachments cannot validate databases

 In file 'fbintf\client\FBClientAPI.pas' at line 254


[Ignore this exception type]

[Break] [Continue]

I have other IBX..x..Services in the same form and I thought they were causing the problem because they were currently .Active = True.  So I set all their .Active := False; so there are no other attachments to the database, except the TIBValidationService itself, yet, I still get the same error message.  I see no difference between what I am doing and what is done in the example.   I don't transfer the .ServiceIntf I just make each TIB..x..Service log in on it's own.

Next thing I need help with, is what options go together?  You can see by my code snippet below that I am putting together options that I think are allowed.  However, I could be wrong.  Please have a look and correct where needed.

Thanks in advance for any help you can provide.



Code: Pascal  [Select][+][-]
  1. procedure TfrmDBStruct.IdxToValOpt(const fnc_idx: Integer; const chk_sums, chk_only: Boolean; const val_scope: Integer; var val_str: String; var val_opts: TValidateOptions);
  2. begin
  3.   {Sweep
  4.   Kill Shadows
  5.   Mend
  6.   Validate}
  7.  
  8.   case fnc_idx of
  9.     0:begin
  10.         val_opts := [SweepDB];
  11.         val_str := 'Sweep';
  12.         if chk_sums then
  13.           begin
  14.             val_str := val_str + ', Include Checksums';
  15.           end
  16.         else
  17.           begin
  18.             val_opts := val_opts + [IgnoreChecksum];
  19.             val_str := val_str + ', Ignore Checksums';
  20.           end;
  21.       end;
  22.     1:begin
  23.         val_opts := [KillShadows];
  24.         val_str := 'Kill Shadow Files';
  25.       end;
  26.     2:begin
  27.         val_opts := [MendDB];
  28.         val_str := 'Mend';
  29.       end;
  30.     3:begin
  31.         val_str := 'Validate';
  32.         if val_scope = 0 then
  33.           begin
  34.             val_opts := [ValidateDB];
  35.             val_str := val_str + ', (Pages only)';
  36.           end;
  37.         if val_scope = 1 then
  38.           begin
  39.             val_opts := [ValidateFull];
  40.             val_str := val_str + ', Full scope (Records and Pages)';
  41.           end;
  42.         if chk_sums then
  43.           begin
  44.             val_str := val_str + ', Include Checksums';
  45.           end
  46.         else
  47.           begin
  48.             val_opts := val_opts + [IgnoreChecksum];
  49.             val_str := val_str + ', Ignore Checksums';
  50.           end;
  51.         if chk_only then
  52.           begin
  53.             val_opts := val_opts + [CheckDB];
  54.             val_str := val_str + ', Check only (No fixes)';
  55.           end
  56.         else
  57.           begin
  58.             val_str := val_str + ', Check and Fix';
  59.           end;
  60.       end;
  61.   else
  62.     ShowMessage('Unknown Index for Validation Option');
  63.   end;
  64. end;
  65.  
  66.  

« Last Edit: February 27, 2018, 06:04:08 pm by RedOctober »

RedOctober

  • Sr. Member
  • ****
  • Posts: 452
I found the problem. I had a TIBDatabase.Connected in another form.  I disconnect it temporarily, run the validation functions, then reconnect.  All works correctly now.  This issue is not closed.

 

TinyPortal © 2005-2018