Connection to PDO DB2

At Scriptcase, we have the following drivers available for connection to DB2: DB2 and DB2 Native ODBC. If you are using your own, pre-configured environment , DB2 extensions must be enabled manually in PHP.

Automatic Installation

If you installed the tool through the automatic installer, and did not install the driver at the time of installation. You must download the DB2 driver installer and install it. The installation will install the client and enable the necessary extensions.

  • : Download

Running the installer

Enter the folder where the installer is located and grant the installer permission

sudo chmod +x

Run the installer


After installing the drivers, go to how to configure the db2dsdriver.cfg clicking here

Manual Installation


Before proceeding with this documentation, check your PHP architecture. In order for the drivers to be enabled correctly, files must be downloaded according to the architecture used .

  • In your Scriptcase, there is the file info.php, access it by the URL:, where you will find the information regarding the architecture in phpinfo(). PHP architecture

CAUTION: Download the dsdriver according to your PHP architecture.

  • Architecture i386/i686 = 32 bits
  • Architecture x86_64 = 64 bits

Required files:



Follow them steps below to correctly enable all drivers in Scriptcase.

1 - Install the dependencies below:

- sudo apt-get update - sudo yum update
- sudo apt-get install libaio1 - sudo yum install libaio-devel
- sudo apt-get install libncurses5 - sudo yum install libaio
- sudo apt-get install alien - sudo yum install glibc
- sudo apt-get install gcc-multilib g++-multilib - sudo yum install compat-libstdc++-33
- sudo apt-get install libpam0g - sudo yum install glibc-devel
- sudo apt-get install ksh - sudo yum install libstdc++
- sudo apt-get install unixodbc-dev unixodbc - sudo yum install libstdc++
  - sudo yum install pam
  - sudo yum install ncurses-devel
  - sudo yum install unixODBC
  - sudo wget
  - sudo yum install ksh-20120801-28.el6.i686.rpm
  - sudo yum install nano

2 - Install the IBM DB2 DsDriver:

- sudo mkdir -p /opt/IBM/Db2 - sudo mkdir -p /opt/IBM/Db2
- sudo cp sudo cp x86_v10.5fp8_linuxia32_dsdriver.tar.gz /opt/IBM/Db2 - sudo cp x64_v10.5fp8_linuxx64_dsdriver.tar.gz /opt/IBM/Db2
- sudo tar -zxf /opt/IBM/Db2/x86_v10.5fp8_linuxia32_dsdriver.tar.gz - sudo tar -zxf /opt/IBM/Db2/x64_v10.5fp8_linuxx64_dsdriver.tar.gz
- sudo ksh /opt/IBM/Db2/dsdriver/installDSDriver - sudo ksh /opt/IBM/Db2/dsdriver/installDSDriver

3 - Restart the Apache service:

sudo service apache2 restart sudo systemctl restart httpd

Configuring the db2dsdriver.cfg file

Before creating the connection in the Scriptcase interface, you need to configure the db2dsdriver.cfg file

1 : Give recursive permission on the file directory if you do not have permission to manipulate the file.

Automatic Installation Manual Installation
- sudo chmod -R 755 /opt/Scriptcase/v9-php81/components/drivers/IBM/Db2/dsdriver/cfg/ - sudo chmod -R 755 /opt/IBM/Db2/dsdriver/cfg/

2 : Open the db2dsdriver.cfg file and configure the file as in the structure below

     <dsn alias="db2" name="db2" host="" port="5000" ldap=1/>
          <database name="SAMPLE" host="" port="5000">

In automatic installation, you must first rename the db2dsdriver.cfg.sample file to db2dsdriver.cfg

In manual installation, if you don’t find the file, you can create it

After configuring the file, restart Apache and create the connection.

Automatic Installation Manual Installation
UBUNTU: sudo service apachesc9php81 restart sudo service apache2 restart
CENTOS/RHEL: sudo service apachesc9php81 restart sudo systemctl restart httpd

Creating a Connection in Scriptcase

See below how to create a connection in your Scriptcase project, using the enabled Driver and the DB2 database.

1 - Access a project from your Scriptcase.

2 - Click the New Connection icon to create a connection

Creating a new connection

or access the Database > New connection menu.

Creating a new connection

After that, a screen will appear with all database connections.

3 - Select the DB2 connection.

Selecting the database connection


Enter the parameters for connecting to your database as follows:

Connecting to the database

  • Connection name: Define the name of your new connection. By default, Scriptcase adds the prefix conn along with the database name.

  • DBMS Driver: Select the Driver for connection. In this example, we use the DB2 ODBC Genérico driver.

  • Server/Host (Name or IP): Enter the System DSN created in the ODBC Data Source.
  • EX: db2

  • Schema: Inform the Scheme of specific tables created for the use of the informed user.
    • This item is optional if you do not have a schema configured in your database .
  • Username: Inform the user to authenticate the connection to your database.

  • Password: Enter the password to complete the authentication process.

  • Test connection: Click this button to get a response to the Scriptcase request to find out if the parameters entered are correct.

Testing the database connection


Accessing this tab, you can configure which Database items will be displayed on the connection, depending on the owner or not.

Filtering the database connection


It allows the connection to see tables, views, system tables and procedures depending on the items selected by the user. By default, the items Tables and Views are already selected by Scriptcase.

  • Tables: Selecting this option, the tables in your database will be displayed.
    • By default, Scriptcase enables this option .
  • Views: By selecting this option, the views of your database will be displayed.
    • By default, Scriptcase enables this option .
  • System Tables: Selecting this option, the system tables of your database will be displayed.

  • Procedures: By selecting this option, the procedures of your database will be displayed.


Allows you to define which tables and owners are displayed.

  • Tables: You can define in this option which tables will be displayed. The configuration can contain a PREFIX%% or name of the tables to display.
    • By default, Scriptcase leaves this option empty .
    • EX:

    Example of using the prefix

  • Owner: Inform the user who sees the tables informed for display.
    • User must be capitalized as in the example above .
  • View: Choose whether tables for the informed owner are displayed.

NOTE: By using table filtering, you eliminate unnecessary tables for your project and improves the performance of your database connection.


In this tab, you have access to specific settings for the connection. The settings made in this session impact the data display and application performance.

Advanced database connection configuration

  • client_encoding: Select the encoding used in your database. In the example above, we use client_encoding UTF-8.
    • By default, this option is left blank by Scriptcase .
  • Decimal Separator: Select the type of separator for decimal records, between comma and period.
    • By default, the . dot is selected as a separator .
  • Persistent Connection: Define whether connections will be closed after the execution of your scripts in Scriptcase applications.
    • By default, Scriptcase disables this option .
  • Use the schema before the table name: Define whether the database schema will be displayed before the table names.
    • By default, Scriptcase enables this option .

Questions or Connection Problems?

Contact our support in case of connection problems or questions regarding this database.