DatabaseIntroduction to C++Learn C++

Learn To Develop Powerful C++ Windows Applications To Connect With An InterBase Database

InterBase is a powerful database developed and supported by Idera / Embarcadero, it has a zero-administration, small-footprint database engine that can power your server and even run on your mobile devices as an embedded database. The InterBase 2020 release adds a number of new features, including tablespaces support for InterBase, allowing for better performance on servers with multiple data-storage options. InterBase 2020 is an ultrafast, scalable, embeddable SQL database with commercial grade data security, disaster recovery, and change synchronization abilities.

If you are asking how i can setup Interbase, we explained well before, please check How to Setup a Simple InterBase Database.

In this post, we will connect to this database and the tables created. So your database and table should be the same as explained before or you should arrange some variables in codes given below according to your database setup. 

To use the InterBase database be sure that it is installed before or you can install it from Tools -> Manage Platforms -> Additional Options Tab. Both IBX Components and InterBase 2020 Developer Editions should be checked. The Latest InterBase installation is explained well here if you need more details.

Now let’s create a simple database connection application.

  1. Create a new C++ Builder VCL or FMX Application
  2. Save all units and project files to a new folder
  3. Drag a Button (TButton) and a DBGrid (TDBGrid) from Tools Palette to Form design (Form1)
  4. Drag IBDatabase (TIBDatabase) to Form design to connect Interbase database, 
  5. Drag IBDataSet (TIBDataSet) to Form design to connect to a table of this database with SQL commands,
  6. and Drag DataSource (TDataSource) to Form design to use DataSet as a DataSource in other components, bindings, etc.
  7. Arrange your design as shown below,

8. Double click to IBDatabase1 component that you placed on the Form to establish connection properties as below,


– Enter database local location file or select Remote to connect remote IP address.
– Add User Name and Password, Character Set that you use
– and Pres OK with Login Prompt is checked.

You can check your connection by checking the Connected Property of IBDatabase Connection. If you have a problem check the settings above or check your database settings by using IBConsole. You may need to read details about How to Setup a Simple InterBase Database post or the official InterBase Get Started Guide here.

9. To connect a table in this database, select IBDataSet1 component and set Database property to IBDatabase1,

10. Double click to SelectSQL property of IBDataSet1, in this window Command Text Editor select table that you want to connect and write SQL your command, i.e. “select * from table1”,

11. Select DataSource1, and set its DataSet property to DataSet1,

12. Select DBGrid1 and set DataSource Property of Grid1 to DataSource1. So, briefly we build connections between IBDataBase1 -> IBDataSet1 -> IBDataSource1 -> DBGrid1

13. Be sure that you Connected property of IBDatabase is false, to connect manually double click to Button and add lines as below,

14. You can also add queries to IBDataSet as below

This is a very basic connection example, you can find more details officially here, on the docwiki about IBDatabase here and about IBDataSet here


Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.

Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He was born in 1974, Eskisehir-Turkey, started coding in college and graduated from the department of Mechanical Engineering of Eskisehir Osmangazi University in 1997. He worked as a research assistant at the same university for more than 10 years. He received his MSc and PhD degrees from the same department at the same university. Since 2012, he is the founder and CEO of Esenja LLC Company. He has married and he is a father of a son. Some of his interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20Learn C++Syntax

What Is Deleted Implicitly-declared Copy Assignment Operator In C++?

C++C++11C++14C++17C++20Learn C++Syntax

What Is A Forced (Default) Copy Assignment Operator In Modern C++

C++C++11C++14C++17C++20Learn C++Syntax

What is Implicitly-declared Copy Assignment Operator In C++?

C++C++11C++14C++17C++20Learn C++Syntax

What is Avoiding Implicit Copy Assignment In C++?