Migrate from Windows to Linux using Kylix3

Source: Internet
Author: User
Tags ibm db2 sql error
Use Kylix3 to migrate from Windows to Linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. Introduction

Use Borland®Delphi 7™Tools such as Studio and IBM®DB2®Universal Database™One of the advantages of such databases is that migration between platforms only requires a small amount of changes and re-compilation. In the first article of this series, I used Delphi 7 Studio to create an application to connect to IBM DB2 UDB. In my second article, I have added more features to this application, such as master-detail reports to make it more interesting and useful. Now that I have created an executable application, let's move on to the next step and use Borland Kylix™3. Run it from Microsoft®Windows®On the Delphi 7 Application to Linux®Application.

Using Kylix 3 to migrate to Linux is quite easy. Borland Kylix 3 is a fast application environment for Linux development. Kylix uses Delphi 7 Object Pascal (and C ++) as the development language, and uses the RAD environment for Linux that everyone is familiar. One of the biggest advantages provided by Borland is that migrating an application is not so much a "porting" project as re-compiling a Windows/Delphi (or Linux/Kylix) project.

When you use Kylix to recompile an application to migrate it from Windows and Delphi 7 to Linux, remember a few points. First, all versions of Kylix contain the TSQLClientDataSet component, which is also available in Delphi 6, but is not encouraged in Delphi 7 and replaced by TSimpleDataSet. Although this does not seem to be a big problem, once you realize that it is a problem, it means that you can only use Delphi 7 to compile TSimpleClientDataSet, instead, TSQLClientDataSet can only be compiled using tools other than Delphi 7.

Migrating applications from Windows to Linux involves obtaining source files and transferring them from Windows to Linux. In Linux, file names (and unit names) are case sensitive. Therefore, if you add your own units, you must be careful (Delphi 7 will ensure that all units and file names are case sensitive ). However, you do not have to transfer all project files from Delphi to Kylix. In particular, the. cfg and. dof files that contain Windows-specific options. Kylix will regenerate these files as. conf and. kof files. In short, you only need (. dpr and. res) and unit files (. pas and. xfm) transfer from Windows to Linux (the code file used in this article can be obtained at the end of the article ).

   DB2 on Linux

In addition to using Kylix on Linux, We must connect to a DB2 version on Linux (of course, you can always connect to DB2 databases on other platforms ). Note: I have tried to use the DB2 Universal Database Personal Edition v7.x, but encountered an Error message: SQL Error: Error mapping failed. Other people who have used dbExpress and Kylix have reported this message. In this case, make sure that the latest DB2 version (v8.1 beta version, can be downloaded from the IBM website) to solve this problem.

   A small amount of source code changes

After the source file is migrated from Windows to Linux, open the project in Kylix (see figure 1 ). When you open the project and view the SQLConnection feature in the Object Inspector, you will see two feature values specific to Win32 that cannot be used on Linux: LibraryName (set to DBEXPDB2.DLL) and VendorLib (set to db2cli. dll ). Linux does not have a DLL; it uses the. so file instead. To change these values, you must first select another value for the ConnectionName feature, and then re-select DB2Connection as the ConnectionName. This sets LibraryName to libsqldb2.so. 1 and VendorLib to db2cli. dll.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.