InterBase ToGo with dbExpress
Go Up to Developing Database Applications
Starting with XE3, RAD Studio provides support for InterBase ToGo databases.
What has changed
Starting with XE3, RAD Studio enhances the dbExpress framework by adding an InterBase ToGo-specific driver. This change makes it easier for users to establish connections to InterBase ToGo databases using dbExpress, in Delphi and C++ applications.
Using the InterBase ToGo Driver
The InterBase ToGo driver can be used only at run time.
If you activate a connection at design time using InterBase ToGo or have an open InterBase ToGo connection in your Data Explorer, and try to run your application, you will get an error at run time. This happens because the InterBase ToGo server license requires exclusive access to the database. Since you already have an open connection at design time, you cannot then open a local connection to the same database in the application you are building/running. InterBase ToGo is intended to be only a deployment option and should not be used in the IDE or the Data Explorer.
Therefore, at design time and in the Data Explorer, the full InterBase client should be used.
Example
The following example is a tutorial on how to establish a connection to an InterBase ToGo database in a Delphi Windows VCL Application:
Steps
- Select File > New > Windows VCL Application - Delphi.
- Add the following components to the form:
- A TButton control; from the Object Inspector, set the Name property of the button to
connectButton
, and the Caption property, toConnect
. - A TSQLConnection control.
- A TMemo control; from the Object Inspector, set the Name to
outputMemo
.
- A TButton control; from the Object Inspector, set the Name property of the button to
- Add the following code to the OnClick event handler for the
connectButton
.
procedure TForm1.connectButtonClick(Sender: TObject);
begin
// create a new TSQLConnection object
SQLConnection1 := TSQLConnection.Create(nil);
// set the driver of the TSQLConnection control
SQLConnection1.DriverName := 'IBToGo';
// add the Database parameter to Params
SQLConnection1.Params.Add('Database=full_path_to_your_database_file');
// set the Username and Password parameters
SQLConnection1.Params.Add('User_Name=SYSDBA');
SQLConnection1.Params.Add('Password=masterkey');
try
// open the connection
SQLConnection1.Open;
Memo1.Text := 'Connection established';
except
on E: Exception do
Memo1.Text := 'Exception raised with message : ' + #13#10 + E.Message;
end;
end;
See Also
- InterBase ToGo
- Mobile Tutorial: Using InterBase ToGo with dbExpress (iOS and Android)
- InterBase 2020 ToGo Quick Start Guide
- Data.SqlExpr.TSQLConnection
- Vcl.StdCtrls.TButton
- Vcl.StdCtrls.TMemo
- Vcl.Controls.TControl.OnClick
- Object Inspector
- System.Classes.TComponent.Name
- Vcl.StdCtrls.TButton.Caption
- Data Explorer
- InterBase