Migrate Your BDE Applications to Linux with dbExpress (cont'd)


Step One: Convert Data to Linux-Friendly Format
The first step in moving your BDE applications to Linux is to convert your data from Paradox or dBASE format to a database format that can be used on Linux. Use the ClientDataSet component, which is part of Delphi 5 Enterprise and Kylix, store the data in native .cds format on Windows, and then reload that .cds file on Linux.

Step Two: Map Equivalent Data Access Components
Now that your data is converted to a dbExpress-compatible format, take a good look at your data access components. The list of components in the Delphi component palette consists of TTable, TQuery, TStoredProc, TDatabase, TSession, TBatchMove, TUpdateSQL, and TNestedTable.

The TDataSource component is not BDE-specific—just the connection between any TDataSet (-derived) component and a data-aware component. As a consequence, you can use the TDataSource component with BDE, ADO Express, InterBase Express, and dbExpress. On my own system, I've moved it to the Data Controls tab of my Delphi component palette (which seems much more logical).

I will focus on the TTable, TQuery, TStoredProc, and TDatabase BDE components. The TSession component is relevant only for BDE-specific applications, and the TBatchMove component is for moving data from one database format to another (useful if you don't want to use the ClientDataSet format to port your data). The TUpdateSQL component is used to execute a SQL statement that doesn't return a cursor (like an INSERT or DELETE), and I'll cover the TNestedTable another time.

The dbExpress tab of Kylix (and presumably the dbExpress tab of the next version of Delphi) contains a new set of components, namely TSQLConnection, TSQLDataSet, TSQLQuery, TSQLStoredProcedure, TSQLTable, TSQLMonitor (which we won't cover), and TSQLClientDataSet. Figure 1 shows the dbExpress tab.

Figure 1  
Figure 1. dbExpress Components in Kylix (Click to enlarge)


The dbExpress equivalent of the BDE TDatabase component is the TSQLConnection component. Both are used to make a connection to the actual database. TSQLConnection has a number of predefined connections, which you'll find in the dropdown list for the ConnectionName property. They include a DB2Connection, IBLocal, MySQLConnection, or OracleConnection. You also can right-click on the TSQLConnection component and pick Edit Connections Properties to see the Connection Settings for the four different Connection Names (see Figure 2).

Figure 2  
Figure 2. dbExpress Connection Dialog (Click to enlarge)


Take a close look at the Database property for the IBLocal Connection Settings. The Database is set to database.gdb. However, when I installed InterBase on my Linux machine, I got only an employee.gdb database, which was found at /usr/interbase/examples/
employee.gbd. So I had to change the database.gdb to /usr/interbase/examples/
employee.gdb in the above dialog to make it work (See the result in Figure 3).

Figure 3  
Figure 3. dbExpress Connection Dialog (Updated Database) (Click to enlarge)


The dbExpress TSQLTable, TSQLQuery, and TSQLStoredProcedure will all use a TSQLConnection component to connect to the database, just as the BDE TTable, Tquery, and TStoredProc components use a TDatabase component to connect to the database.




Previous: Introduction
 
Next: Single-Value Input Fields


Introduction One-Way Datasets: A Blessing and a Curse
Step One: Convert Data to Linux-Friendly Format Solution in Action: Create an App with Delphi/Windows and Kylix/Linux


Return to Get Help with Delphi Page

Return to Main Get Help Page
 
The Borland Database Engine (BDE) runs only on Windows, so Delphi applications that use it are not portable to Linux.




Move your application from the BDE to dbExpress, the new cross-platform, data access layer found in Kylix and future versions of Delphi, by replacing BDE data access components with corresponding dbExpress components and converting your data.


Find Out More
• Get the source code for this Solution!

• The borland.public.kylix.database.dbexpress newsgroup at newsgroups.borland.com

• The Kylix For Delphi Developers page on the Borland Web site

TALK BACK
Do you expect dbExpress to replace the Borland Database Engine? Delphi 6 has been rumoured to include support for both the BDE and dbExpress. But will your new Delphi 6 projects be using BDE or dbExpress? Let us know in the database development discussion groups!
 





Sponsored Links