Link to home
Start Free TrialLog in
Avatar of peterhindle
peterhindleFlag for United Kingdom of Great Britain and Northern Ireland

asked on

InterBase component causes crash in Delphi app.

I'm trying to trace the cause of a problem in an application I'm building using Delphi 2010 and InterBase 2009.

If I include an IBDatabase component on a form, the app will run on my development PC. However, if I try to run the executable on the 32-bit Windows XP Pro target machine, it crashes with the "Project1.exe has encountered a problem and needs to close.  We are sorry for the inconvenience" message.

In attempting to diagnose the problem, I created an app containing an empty form, and another app with a form with a few, non-database components on it. They both run on the target machine without a problem.

Then I dropped a component of type TIBDatabase on the empty form, leaving its properties as the defaults.  The app runs in the IDE, and runs as a stand-alone executable on my development PC.  However, if I try to run it on the target PC, I get the usual crash.

I have just re-installed InterBase 2009 Server edition, with one user, on the target PC, and have verified that I can access the database on it using IBConsole.  I suspect that the problem may be related to the setup/configuration of InterBase on the target PC, but I'm at a loss as to what to look for next.

It would appear that the mere presence of an InterBase component on a form will cause the app to crash on the target machine.

The real sickener is that I have had the database application running on this target PC, but an unrelated problem meant that the machine was wiped and the OS reinstalled recently, since when I've been having this problem.

Please help!

Thanks,

Peter
Avatar of bjove
bjove
Flag of North Macedonia image

What protocol do you use in TIBDatabase component?
Avatar of peterhindle

ASKER

I'm not sure that I understand the question.  The IBDatabase component is left with the default values, but of course the component itself doesn't have a 'protocol' property.  The communication between the InterBase server and the client (the app that crashes) is local--i.e. not TCP/IP nor NetBEUI.

Have I answered your question satisfactorily?

Peter
You don't even try to open the database in code and AV is generated?
You can try to create the TIBDatabase object in code, so you can trace the creation of the Database object and see what causes the AV. Add IBDatabase.pas unit in your project (on my PC path is "'c:\program files (x86)\embarcadero\rad studio\7.0\SOURCE\WIN32\IBX\IBDatabase.pas').  Configure remote debugger on target machine (http://delphi.wikia.com/wiki/Remote_Debugger). The guide is for d2007/2009, but it is same for d2010. Then try to trace the code in the constructor of the TIBDatabase. Hope this helps.

You can also use this code to check if interbase client is installed correctly and can be loaded. (http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/IBIntf_CheckIBLoaded.html)
You have to add IBIntf in uses clause.
procedure TForm1.Button1Click(Sender: TObject);
begin
  try
    IBIntf.GetGDSLibrary.CheckIBLoaded;
    ShowMessage('IB is installed');
  except
    ShowMessage('IB is not installed');
  end;
end;

Open in new window

Thanks very much for your responses.

I tried checking to see if the IB client is loaded, by putting the code in the form's CreateForm method, but unfortunately the program crashes before it gets that far.

I'm now going to try the other idea you suggested, and create the TIBDatabase object in code. I'll let you know how I get on.

Thanks again,

Peter
ASKER CERTIFIED SOLUTION
Avatar of bjove
bjove
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oh! How stupid of me. Sorry!

I follwoed your excellent suggestion, and the program reports that IB is *not* installed. So that seems to be the problem, now have you any idea how I fix it, please?

Some further information: I've checked to see if GDS32.dll is present on the target machine, and it is, in C:\CodeGear\InterBase\Bin. Does it need to be in the %System32% folder?

Post script: I've copied GDS32.dll and Interbase.msg to the folder containing the executable, and the test program now reports that IB is installed.  Looks promising, and I'll have a go with the full program now.  Will report a little later.
Yep - app now runs as it should.  Very many thanks for your help.

Peter
Try to copy gds32.dll from your development PC to target PC in system32 folder.
Hmm... once I knew that the problem was related to gds32.dll, I discovered that this is a known bug.  It's documented here (with a workaround):

http://support.codegear.com/article/40247

Of course, as I had no indication that the problem was caused by a missing gds32.dll, I wasn't able to find the article which would have solved the problem.

I hope that this helps others in future.