﻿ZendDBi is based on MariaDB version 10.1.12 with extra support for IBMi.

System requirements
  * Operating System:
     * IBMi 7R2/7R3
     * IBMi 7R1 (With the following PTFs: MF99011,MF59547, MF51795)
  * Extra packages:
   * PASE (Option 33).
   * OpenSSL libraries - IBM Product number: 5733-SC1
   * OpenSSH is recommended for advanced management (included in 5733-SC1).
  * CPU: POWER6 or better.
  * Disk space: 1GB disk space.
  * RAM: 1GB

Installation instructions

Overview
To install Zend DBi please perform the following steps using the detailed instruction below:

  1. Backup any existing mysql installation and configuration.
  2. Read the installation instructions.
  3. Verify that your system meets requirements and has the necessary PTFs installed.
  4. Create the installation SAVF in QGPL named ZDBISAVF10.
  5. Upload the installation package into the SAVF file on your system using FTP.
  6. Run the installer.

Step 3 - Verify system requirements are met (optional):
You may verify that the required PTFs are installed using these commands in a 5250 terminal session:
  On 7R1:
    * DSPPTF LICPGM(5770999) SELECT(MF99011) 
    * DSPPTF LICPGM(5770999) SELECT(MF59547)
    * DSPPTF LICPGM(5770999) SELECT(MF51795)

In the menu that is displayed go to “General Information”:
PTF status should either be “temporarily/permanently applied or superseded”.

Step 4 - Create the installation SAVF file
  1. Log on to the IBM i system 5250 terminal with a user profile of *SECOFR user class with all the special authorities (such as QSECOFR).
  2. CRTSAVF FILE(QGPL/ZDBISAVF10) TEXT('ZendDBi 10 product save file')
  3. You should see one of these two messages (both are OK):
   * File ZDBISAVF10 created in library QGPL.
   * File ZDBISAVF10 in library QGPL already exists.
  
Step 5 - Upload the installation package to your system (FTP)
Transfer the package using FTP in binary mode to the SAVF ZDBISAVF10 in QGPL:
  1. Verify that FTP is running on your IBM i system by running the following command and look for 'FTP' or '21' in the Local Port column:    NETSTAT *CNN
  2. Open a command prompt and change the directory to the directory that contains the files you extracted from the ZIP file.
  3. Run the FTP command, specifying the name of your i5/OS system. e.g:
  4.   ftp IBM_i_system_name/TCP address
  5. If requested, enter a valid user profile and password (with write permissions to QGPL).
  6. Switch to “binary” mode transfer (command may vary by client: bin/binary/type i).
  7. Transfer the save file to the IBM i system by running the following command:
     PUT zdbisavf10.savf QGPL/ZDBISAVF10

Step 6 - Run the installer

Return to your 5250 session and run the installer. You can either run the silent installer or install interactively (recommended).
Interactive installation:
  1. Run the command following command to launch the installer: 
    RSTLICPGM LICPGM(1ZENDDB) DEV(*SAVF) SAVF(QGPL/ZDBISAVF10)
  2. Wait for the installer to extract temporary files (You’ll see an “X - System” message).
  3. Carefully read the information in the welcome screen and press “Enter”  
  4. Read and press “Enter” to accept the EULA
  5. If an existing MySQL is detected you will be prompted to choose a different port for Zend DBi 10.  Either accept the new default (3307) or type a different port number and press F10 to continue ( or F3 to abort the installation):  
  6. Wait for installation to complete (this might take some time):  
  7. Once installation is complete press “Enter” to continue  
  8. Carefully review the information in the installation summary screen and press “Enter” to start the ZENDDBI10 subsystem.
  9. Installation complete.

Silent (batch) installation:
Enter the following command in a 5250 session to launch a batch installation job:
  SBMJOB CMD(RSTLICPGM LICPGM(1ZENDDB) DEV(*SAVF) SAVF(QGPL/ZDBISAVF10))

You will see a message with the job and queue details

Usage

Managing ZendDBi from a 5250 terminal (ILE):

Enter command STRZDBI or GO ZMARIADB/ZCMYSQL - This will display a menu that allows to manage ZendDBI process and configuration:

Menu options:
  * 1 / 2 - Start/Stop the ZENDDBI10 subsystem  
  * 3   - Check ZENDDBI10 subsystem status - You can check the status of the subsystem and that of each of the daemons. If everything is running properly it should look like this:  
  * 10/11  - Start/Stop the ZendDBi daemons without restarting the whole subsystem.
  * 20       - Work with MY.CNF - edit MariaDB configuration file.
  * 21/22  - Toggle the start of ZENDDBi during IPL.
  
Day to Day Management
Your ZendDBi instance comes with a pre-installed mysql client which can be run from PASE. You can either use it or use any other mysql or mariadb client(either remote or local) to manage your server.

Starting the mysql client from your ZENDDBI server
The mysql client can either be started from QSH or from an ssh session (recommended). If you connect from ssh you’ll gain access to the full formatting options available in your terminal:
  1. ssh to your server (as QSECOFR) or start QSH or QP2TERM from your “5250 session”.
  2. Optionally add the directory /usr/local/mariadb/bin to your path.
  3. If running from QSH then : export TERM=xterm
  4. /usr/local/mariadb/bin/mysql  (by default 'root' has no password from localhost) .

Connecting using a remote mysql client (or local using non-default port)
If you wish to manage mariadb using a remote mysql client or if you configured ZendDBi to use a non-default port/socket then you can use one of the following options:
  * /usr/local/mariadb/bin/mysql --socket /usr/local/mariadbdata/mariadb.sock (local)
  * /usr/local/mariadb/bin/mysql --host <server_ip> --port <server_port>

Note: ZENDDBI listens on port 3306 and socket /tmp/mysql.sock by default and is open to outside computers. Access from outside is only allowed for users with passwords (GRANT will fail to create users with no password).

If you installed ZendDBi 10 (Mariadb) side by side with a previous mysql then it will listen on a different port (default: 3307) and socket (default: /usr/local/mariadbdata/mariadb.sock)  ( according to the installation summary screen). After installation it can also be retrieved from the MY.CNF file (option 20 in the menu).


F.e : /usr/local/mariadb/bin/mysql --socket /usr/local/mariadbdata/mariadb.sock 


Installing PHPMyadmin from Zend Server.
  1. Set a password for the mariadb root account.
  2. Install according to the instructions below:
     http://files.zend.com/help/Zend-Server/content/installing_phpmyadmin.htm
     https://www.youtube.com/watch?v=46iPmOH4BLc

If you used a non default port/socket you will need to update phpmyadmin’s configuration.
Uninstalling ZendDBi
You can uninstall ZendDBi 10 by issuing the following command in a 5250 terminal session: DLTLICPGM (1ZENDDB)

This will remove ZENDDBI files and configuration from your system. 
Your existing data will be moved to the directory /usr/local/mariadbdata<timestamp> (f.e: /usr/local/mariadbdata20160426122959 ) for backup purposes.


Known Issues


Problem: mysql client fails to start in QSH with the message “Terminal unknown is unknown”.
Workaround: Issue the command “export TERM=xterm” in the QSH session before running the mysql client (you can also add it to your /etc/profile so it runs each time QSH is started).

Problem: Installation may fail if non IBM versions of OpenSSL are installed.
Workaround: Stop any services that depend on your custom openssl product. Temporarily rename libcrypto.a and libssl.a
