Using Cygwin Simulated DB2 Unix / Linux Development Environment
Roc.fu
Brief introduction ... 2
Install Cygwin. 2
Running the installer ... 2
Select download location ... 3
Select a installation directory ... 4
Select a temporary installation directory ... 5
Specify your Internet connection ... 6
Select the download site ... 7
Select package to install ... 8
Complete download ... 10
Configure DB2 environment ... 11
Set environment variables ... 11
Performed Cygwin, which initializes the DB2 environment.
Write SQC program ... 15
Modify compilation parameters ... 15
Run test procedure ... 16
Summary ... 17
Attachment ... 17
Makefile. 17
Test.sqc. 18
Introduction
in
Used on the Windows platform
C / C write
DB2 applications need to be installed
C compiler (usually used
VC ). Be limited to
SQC source code transplantation
There is a lot of inconveniences under UNIX, let alone
Win32 and
Unix different characteristics, such as services and daemons, messages, and model numbers, these are the mechanisms determined by the system characteristics, and cannot be transplanted by simple source code.
Everyone's personal computer will of course choose
Windows is doing a desktop system, how can I be in?
It is also easy to transplant under Windows.
The UNIX program, through
VMware or
The software of the Visusl PC, can virtualize a computer, complete installation
Linux system to achieve this
UNIX development environment. such
Windows has,
Linux is also available. However, such a virtual machine system is highly required by physical hardware, and so that the program developed by the system is the native code of the parasitic system, and the homage system is impossible, and the reverse compatibility has become a problem.
Here I recommend a one
LINUX simulation environment
Cygwin,
Cygwin is
Redhat's products, it provides
One of the Windows operating system
UNIX environment, it can help program developers take the app from
Unix / linux ported to
Windows platform
(Of course, it is also
Windows platform development convenient transplantation
UNIX Linux code
), Is a powerful toolset.
This article will tell you how to install
Cygwin and configure one
DB2 development environment
(with
The same size under UNIX!
)
Install Cygwin
Point your Internet browser to www.cygwin.com. At the center of the screen is a "C" logo composed of black and green, the title is "Install or Update Now.". Click on the link, which will download a small program setup.exe (250KB). This installer will boot the installation or update process of the Cygwin environment on your machine.
Run the installer
will
Setup.exe downloads to a known place, such as a desktop, and then run it.
It will open the installation wizard, as shown below:
Figure
Cygwin
Environmental installation wizard
Click
NEXT button.
Select download location
On this page, choose
"Install from internet".
Figure
2.
Select the installation type
Click
NEXT button.
Select a installation directory
On this page, choose Execution
Cygwin's directory.
Set diagram
3 The remaining options shown.
Figure
3.
Select a installation directory
Click
NEXT button.
Select a temporary installation directory
In this page (Figure
4) Select a temporary directory for the installation package. when
After the Cygwin is installed, you can delete this directory and its content.
Note The installer remembers this directory and downloads only the version updated than the package in this directory when updating. If you delete this directory and reinstall, Setup will reinstall all the content you selected regardless of the installer of these packages already exists in the run directory.
Figure
4.
Select a temporary installation directory
Click
NEXT button.
Specify your Internet connection
On this page (Figure
5), designated
Internet connection. If you have a proxy server, choose Using
IE5 Settings, or get the server name from your browser option, select Using the Agent, then enter the host name and port number of the proxy server.
Figure
5.
Select connection type
Click
NEXT button.
Select the download site
On this page (Figure
6) Select a download site. Because these sites are mirrored images, choose a little risk of download points (usually they are available, but sometimes not available). Usually, try the site that is close to you.
Figure
6.
Select a download site
Click
NEXT button.
Select package for installation
On this page, you will select the package you want to install. by default,
Cygwin basic package will not be installed
GCC, so you must modify the default settings.
Move the mouse to
DEVEL side of the plus (
) On, then click on it to expand
DEVEL class.
Figure
7.
Select package for installation
You will see
There are many entrances under Devel, only three of which are what you need, the order is as follows:
Binutils GCC GCC-MINGW
Not all default basic packages need to be run
GCC, but they are not too big, so install them simplified.
Note It is easy to select the wrong package or version, especially when reinstall, because the loop button in the selection window is not standard. In this step we recommend more care, especially if there are multiple
GCC version of the GCC version.
To select these three packages, click on the column
Each two-way arrow in New is displayed until the version number of each package is displayed. According to the appropriate version of the installed and mirror, the inlet is included in each icon:
If there are multiple versions available, select the maximum number of numbers. To download the binary, make sure "
BIN column checkbox.
Figure
9.
Download binary files
Complete download
After selecting three packages,
Cygwin accesses the selected mirror host and downloads the three packets and the default basic package. According to your connection speed, this will last for a few minutes. Many pop-up windows will be turned on and off during installation.
Because of storage
The mirror site installed by Cygwin is obligated, sometimes unavailable or loaded too heavy. If you find that the selected mirror is not responding, press Cancellation
(
Cancel), which will terminate the entire installer.
The only way is to start installing and selecting another mirror; this is very frustrated. Fortunately, the installer remembers most of your last, so it usually takes the default. Be careful when reselecting the correct package, because you don't help you choose this in the back installation.
Setup program then ask if you create one in your desktop or start menu
Cygwin shortcut. This shortcut is started
Cygwin shell
Bash), this is planned
DB2 is not required, but it is useful for testing our installation. Hassually
Setup creates at least one desktop shortcut. We will use it behind the installation.
Finally, click
Finish button.
Figure
10.
finish installation
Configure DB2 environments
Set an environment variable
Open "Control Panel" -> System -> Advanced -> Environment Variables, add an environment variable
DB2PATH
Note that if you add DB2PATH is x: / program files / ibm / sqllib (x is a drive letter), then you must change the path to x: / progra ~ 1 / ibm / sqllib, because the Cygwin environment cannot identify spaces Directory name. Why do you want to do this? Because after the DB2 environment is installed, there is no configuration of DB2PATH environment variables.
When the user enters the DB2 command line environment, the DB2CMD this command adds DB2Path environment variables to the current command line window. Also, if your DB2 is installed under the default path, DB2CMD automatically adds the environment variables must be db2path = x: / program files / ibm / sqllib.