IBO has been designed in a way that allows it to coexist with the BDE in the same application.
In fact, because it is possible to get the native connection handle of the InterBase connection from the TDatabase component it is possible to allow the IBO components and controls to share the same connection as the BDE's components and controls.
It is NOT possible to have them share the same transaction though. The TDatabase component does not allow this handle to be retrieved in its native form.
Here is a code sample that shows how to obtain the native handle from the BDE and use it in an IBO connection. It is done using the dbHandleShared property of the TIB_Connection class. Be sure to assign nil to this property or call Disconnect before the TDatabase closes though so that there will not be any orphaned transactions or statements.
function GetNativeHandle(Database: TDatabase): Pointer;
var
length: word;
begin
// This is how you get a native IB handle out of a TDatabase.
Result := nil;
if Assigned( Database ) and
Database.Connected and
( Database.DriverName = 'INTRBASE' ) then
Check( DBIGetProp( HDBIOBJ( Database.Handle ), dbNATIVEHNDL,
@Result,
SizeOf( Pointer ),
length ));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
// An IB_Connection can take a raw handle from a TDatabase
bdeDatabase.Connected := True;
iboDatabase.dbHandleShared := GetNativeHandle( bdeDatabase );
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
// Before the TDatabase closes be sure to clear the dbHandle out of the
// IB_Connection. Otherwise, it may attempt an operation after the handle has
// become invalid.
iboDatabase.dbHandleShared := nil;
bdeDatabase.Connected := False;
end;