Setting up TXSeries with PostgreSQL
PostgreSQL is an open source, object-relational database. It is extensible, ACID (Atomicity, Consistency, Isolation, and Durability) compliant, and supports high availability, and backup and restore functions.
PostgreSQL client libraries are needed to configure TXSeries® containers with PostgreSQL database.
For IBM® COBOL programs, use IBM COBOL for Linux® on x86 version 1.2.0.6, which includes APAR (Authorized Program Analysis Report) PH65575. For more information about PostgreSQL support with IBM COBOL, see Programming for a PostgreSQL environment.
Preparing a TXSeries region on a stand-alone on-premises deployment with PostgreSQL for C® and COBOL programs
You need a 64-bit PostgreSQL client/server installed along with the TXSeries stand-alone on-premises deployment.
To install the PostgreSQL components, complete the following steps:
-
Run the following commands:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8- x86_64/pgdg-redhat-repo-latest.noarch.rpmsudo dnf -qy module disable postgresqlsudo dnf install -y postgresql16-serveryum install postgresql16*sudo /usr/pgsql-16/bin/postgresql-16-setup initdbsudo systemctl enable postgresql-16sudo systemctl start postgresql-16 - Verify the installation by using the following
commands:
sudo -u postgres -i psql < $CICSPATH/examples/RM_support/PostgreSQL/cicspsql_cheese.sqlsudo -u postgres -i psql \c cicstest select * from cheese;
By default, the PostgreSQL server listens on 127.0.0.1 (localhost) and port 5432. You cannot connect by using IP from outside the server. If you want to connect to the PostgreSQL server by using the IP address of the host machine, you need to edit the pg_bha.conf file and restart the PostgreSQL server.
- Edit the /var/lib/pgsql/16/data/pg_hba.conf file:
Replace "host all all 127.0.0.1/32 scram-sha-256" with "host all all 0.0.0.0/0 scram-sha-256".
- Edit the /var/lib/pgsql/16/data/postgresql.conf file:
Replace "#listen_addresses = 'localhost'" with "listen_addresses = '*'"
- Restart PostgreSQL:
systemctl restart postgresql-16
A sample is provided in $CICSPATH/examples/RM_support/PostgreSQL. Refer uxa1.README and nxa1.README that are provided in $CICSPATH/examples/RM_support to build and run samples for XA and non-XA programs.
Preparing a TXSeries container with PostgreSQL for C and CobolCloud programs
You need a 64-bit PostgreSQL client to be installed with the TXSeries container.
To install the 64-bit PostgreSQL client, use the following Dockerfile snippet as a reference. The snippet provides an example of installing a PostgreSQL client on the TXSeries container. To use CobolCloud programs, you need to install CobolCloud and use the SQL precompiler cldsql.
USER root: root
RUN microdf install yum
# RUN yes | yum module install postgresql: 16/server (uncomment if server needed)
RUN yes | yum module install postgresql: 16/client
RUN yes | yum --enablerepo=codeready-builder-for-rhel-8-x86_64-rpms install libecpg-devel
RUN useradd postgres (applicable only for client)
# RUN su - postgres -c "initdb /var/lib/pgsql/data pg_ctl/var/lib/pgsql/data -l logfile start (uncomment if server needed