Subject Re: [IBO] Re: Install Problems and After Install Problems
Author Helen Borrie
At 07:54 AM 2/04/2006, you wrote:
>I checked the creation order. Both TDatabase and the IB_Connection is
>in a datamodule. Not sure how to check the real creation order, but
>the TDatabase is the 2 item listed in the dfm.

You need to set the creation order in the form or datamodule. The
order of appearance in the DFM has nothing to do with it - the DFM is
just a "telephone book" that the compiler looks up when it wants to
find out the attributes of an object. This is basic Delphi
stuff! Right-click on the form or datamodule, select Creation
order.. and then use the arrow control to move the non-visual
components into the order you want them created.

>Also, just to make sure, I freed the IB_Connection and recreated it,
>but I still get the same error. I also made sure that nothing was
>trying to use this connection yet. I have a tool to show the
>function calls. I have pasted that below... The top line is where
>the error was thrown from.

It doesn't show anything about the creation of the dbhandle. Also,
disconnecting from a shared handle (if it exists) WILL give you an AV
if you already disconnected from the TDatabase. And calling
Disconnect from a tib_connection to a shared handle doesn't close the
connection that it is sharing with the TDatabase. If you disconnect
the TDatabase and then later try to reference the associated
dbhandle, you will get an AV from trying to access dereferenced pointers.

>I even tried to connect the IBO connection..Disconnect then assign
>the db handle. That does not seem to work as well.
>I did try to connect then disconnect, then assign the dbhandle. I
>did not see an error there, but it seems to error now on any bde
>queries that I try to open. So at first I thought I had found a
>solution, but it seems I am still stuck....

Yep. Go back to the creation order and attend to that. Besides
paying attention to the creation order of the two database
connections, ALSO look at your statement objects. Make sure that no
queries are referencing higher objects that are not yet created. Then
look at your code and your interface, and make sure you have no
places where references are being made to a dbhandle that may not exist.

Tip: it may help if you create an explicit TIB_Session and make *it*
the very first object in the creation order.

And don't overlook the fact that, although you have two connections
sharing the same database handle, each connection is running in its
own transactions. You will get AVs if you try to reference things in
one transaction from a different transaction.