These are
instructions for building PMF on your on system. You can also download ready-to-run versions for both Linux and Windows.
If you get stuck at some point, drop me a mail (pmf [at] leipelt [dot]
net) and I'll try to help.
Building PMF on Linux
PMF uses plugins to access databases. You can build PMF with one or
more of these plugins:
- Plugin using DB2 Native Client (aka Client Application Enabler). This
requires the application development tools being installed (from the DB2
install media).
- Plugin using DB2 ODBC. Requires UnixODBC and "BM Data Server Client
Packages" from IBM's website.
- Plugin using ODBC for SQL Server. Requires UnixODBC and FreeTDS.
- Plugin using Postgres
- Plugin using MariaDB (a bit experimental)
To use PMF, at least one of these plugins has to be built.
Why are there two plugins for DB2?
DB2 ODBC requires less preparation on the client, but DB2 Native
Client has more to offer:
- Import and Load of IXF, DEL and WSF files (including LOBs and XMLs)
- Export of tables as IXF, DEL and WSF
- Monitoring support
- Generally faster
If you want to use PMF with DB2, you should definitely build the plugin
for the DB2 Native Client.
Here is a short overview of the build requirements, covered in more
detail below.
- g++ compiler
- Qt5 or Qt6 development packages
- make
- zlib-dev
|
- DB2 Application development tools (part of DB2)
- A working database connection
|
- IBM Data Server Client Packages
|
- FreeTDS
- unixOBDC-dev
- unixOBDC
- tdsodbc
| Development
packages for
Postgres and MariaDB
(see below)
|
1. What you need:
g++ compiler: Search for 'gcc-c++' in your distribution's package
manager
Qt5 (or Qt6 if you prefer) development packages: Search for 'libqt5-devel' (or
'lib64qt5-devel' on 64bit systems) in your distribution's package
manager
make
zlib development files, which depending on your distribution may be
contained in zlib1g-dev
1.1 Preparation for DB2:
If you want to build the DB2 plugins (both ODBC and native client):
DB2 for Linux, version 9 or higher: You can download the Express version
directly from IBM. During DB2's
setup, make sure to choose "Custom setup" and select "Application
development tools" (this is not selected by default)
You need at least one working database connection on your system. The
easiest way to achieve this is to install the "sample" database: Simply
run 'db2sampl' (not: 'db2sample') to create this database.
It is possible to build only the ODBC plugin. For this you will need
"IBM Data Server Client Packages", directly from IBM.
1.2 Preparation for SQL Server:
If you want to build the SQL Server plugin, you need to install these
package groups:
FreeTDS including "development" (e.g. freetds-bin, freetds-common, freetds-dev, tdsodbc)
UnixODBC including "development" (unixodbc, unixodbc-dev
1.2 Preparation for Postgres
If you want to build the Postgres plugin, you need to install these
package groups:
postgresql
libpq-dev
1.3 Preparation for MariaDB
If you want to build the MariaDB plugin, you need to install these
package groups:
mariadb-server
libmariadb-dev
libmariadb-dev-compat
When everything is ready, unpack pmf.tar.gz in a suitable directory:
$ mkdir pmf
$ cd pmf
$ tar -xzv pmf.tar.gz
2. Makefile and Compiling
This is not the usual "configure && make && make install".
Instead, I'm using Qt's rather brilliant build system.
It basically takes a configuration file ("pmf5.pro" in this case) and will
create a Makefile from that.
The Makefile will be generated when you run "qmake pmf6.pro" (if you installed Qt5) or "qmake6 pmf6.pro" (if you prefer Qt6)
Whenever you want to re-generate the
Makefile, make sure to run "$ make distclean" first
OK, let's generate a Makefile. Here you have to decide which plugin to
build.
You can build PMF with plugins for DB2 using the native client, for DB2
using ODBC, and for SQL Server or all of them.
Note: The commands below are
case-sensitive.
Creating a Makefile for PMF and plugins always takes this form:
$ qmake pmf6.pro "target=plugin(s)" "[Connection Info]"
Chose which plugins to build and set "target" accordingly:
What to build |
Target |
Required Connection Info |
DB2 NativeClient + DB2 ODBC + SqlServer + Postgres
|
"target=all" |
"db=sample" ["uid=..."] ["pwd=..."] |
DB2 NativeClient + DB2 ODBC |
"target=db2all" |
"db=sample" ["uid=..."] ["pwd=..."] |
|
DB2 NativeClient |
"target=db2cae" |
"db=sample" ["uid=..."] ["pwd=..."] |
|
DB2 ODBC |
"target=db2odbc" |
- |
SQL Server |
"target=sqlsrv" |
- |
Connection Info is required during build (a BIND file needs to be created),
and you may pass this info like this (replace "sample" with an existing
database):
Note: For Qt6, replace "qmake" with "qmake6"
$ qmake pmf6.pro "target=..." "db=sample" <-- works if database is on the local machine
- OR -
$ qmake pmf6.pro "target=..." "db=sample" "uid=userName" <-- prompts for password during build
- OR -
$ qmake pmf6.pro "target=..." "db=sample" "uid=userName" "pwd=password" <-- writes uid and pwd into the Makefile (not recommended)
A few examples:
Note: For Qt6, replace "qmake" with "qmake6"
-- Build all plugins:
$ qmake pmf6.pro "target=all" "db=sample" "uid=db2inst1"
-- Build both plugins for DB2:
$ qmake pmf6.pro "target=db2all" "db=sample" "uid=db2inst1"
--SqlServer only
$ qmake pmf6.pro "target=sqlsrv"
Finally, run
$ make
This will build PMF and the plugin(s). Again, if you get stuck at some
point, drop me a mail (pmf [at] leipelt [dot] net) and I'll try to
help.
3. Building PMF on Windows
Note: You can simply download a
precompiled (ready-to-run) version. These instructions are intended for
those who are looking for a challenge.
I'm currently using MS Visual Studio 2010 Express Edition. It is possible to
build PMF with MinGW but there are massive problems when linking against the
libs of DB v7. If you intend to use only DB2 v9 (and presumbly higher),
using MinGW is fine.
You can build PMF with a plugin for DB2 or a plugin for SQL Server or both.
Building the plugin for DB2 requires that the application development tools
for DB2 are installed.
To use PMF, at least one of these plugins has to be built.
3.1 What you need:
compiler: MinGW (for DB2 v9) or MS VS 2010 or above (DB2 v7 and above)
Qt5 or Qt6: depending on compiler, download directly from Trolltech
3.2 Preparing for DB2
If you want to build the plugin for DB2:
DB2 for Windows, version 7 or higher: You can download the Express
version directly from IBM. Make sure to choose "Custom install" and
install "Application development tools" (this option is not selected by
default)
You need at least one working database connection on your system. The
easiest way to achieve this is to install the "sample" database: Simply
run 'db2sampl' (not: 'db2sample') to create this database.
3.2 Preparing for SQL Server
If you want to build the plugin for SQL Server:
"SQL Server development tools" (part of SQL Server install media)
or "Microsoft Data Access SDK" (haven't tried that)
3.3 Preparing the environment
Unzip pmf5.zip into a suitable directory.
To build PMF, the build environment variables for Qt and your compiler need
to be set. One way to do this is to create a batch file.
This would look something like this:
rem **********************************
rem This is a template for setting the build environment
rem for Qt and MS VC2010
rem **********************************
rem MS VC compilers need this.
rem You may have to provide the full path to vcvars32
rem *** EDIT THIS IF NECESSARY ***
call [path to\]vcvars32.bat
rem ONLY FOR DB2 v9 on WINDOWS: The environment variable DB2PATH apparently is not set.
rem Set it here:
rem *** EDIT THIS IF NECESSARY ***
set DB2PATH=c:\Program Files (x86)\SQLLIB
set LIBPATH=%LIBPATH%;%DB2PATH%\lib
rem *** EDIT THIS IF NECESSARY ***
SET QTDIR=e:\qt\Qt5.3.0_msvc2010\
set path=%PATH%;e:\qt\Qt5.3.0_msvc2010\5.3\msvc2010_opengl\bin\
rem QT needs to know which compiler is used
rem *** EDIT THIS IF NECESSARY***
SET QMAKESPEC=win32-msvc2010
rem *** No need to edit this ***
set path=%PATH%;%QTDIR%\;%QTDIR%\bin;
set path=%PATH%;%QTDIR%\qt\bin;
set include=%INCLUDE%;%QTDIR%\include\QtGui\;
set include=%INCLUDE%;%QTDIR%\include\QtCore\;
set include=%INCLUDE%;%QTDIR%\include\Qt\;
set include=%INCLUDE%;%QTDIR%\include\;
set include=%INCLUDE%;%QTDIR%\;
In the directory where you unzipped PMF you will find 'pmf_MSVC.bat' which
you can edit to fit your environment.
3.4 Building PMF
If you want to build the plugin for DB2 or both plugins, open a DB2 command
line: run "db2cmd". This will open a "DB2 CLP", which looks like the normal
command line but has additional environment settings.
In the command line (DB2 or standard), navigate to the directory where you
unzipped PMF and run the batch file from above to set the environment
variables
The following steps will generate a Makefile for the actual build process.
Whenever you want to re-create the
Makefile, make sure to run "make distclean" first
3.4.1 PMF for DB2
The next step will create a
Makefile. Run one of the following commands in the DB2 CLP:
qmake pmf6.pro "target=all" "db=sample"
- OR -
qmake pmf6.pro "target=all" "db=sample" "uid=userName"
- OR -
qmake pmf6.pro "target=all" "db=sample" "uid=userName" "pwd=password" <--careful with this, see below
Replace "sample" with the name of an existing DB2 database.
uid and pwd are needed to connect to the DB2 database. During the build
process, a database connection is
necessary for the precompiler to generate a BIND file.
The first option (without uid/pwd) will work if the database
"someDB2database" is installed locally.
The second option will prompt you for the password during
the build process.
The third option will write uid and pwd
into the Makefile, and this is probably not what you want.
Finally, run
make
or
nmake
depending on your compiler.
3.4.2 PMF for DB2, ODBC plugin only
You can also build only one of the DB2 plugins. To build the ODBC plugin
only, run
$ qmake pmf6.pro "target=db2odbc"
$ make
3.4.3 PMF for DB2, plugin for the native client
If you do not want to build the ODBC plugin, run one of these commands:
$ qmake pmf6.pro "target=db2cae" "db=sample"
- OR -
$ qmake pmf6.pro "target=db2cae" "db=sample" "uid=userName"
- OR -
$ qmake pmf6.pro "target=db2cae" "db=sample" "uid=userName" "pwd=password" <--careful, see above
"sample" is the name of an existing database.
Finally, run
$ make
3.4.2 PMF for SQL Server
If you want to build only the plugin for SQL Server, open a standard command
line and set the environment paramters for Qt and compiler (see above).
Run this command:
qmake pmf6.pro "target=sqlsrv"
This will create a Makfile.
Next, run
make
or
nmake
depending on your compiler.
3.4.3 PMF for DB2and SQL Server
This is the same as in 3.4.1, simply replace "target=db2" with "target=all"
If everything worked as intended, which it sometimes does, you should now be
able to start PMF.