CA Microgateway: Error with Postgresql

Document ID : KB000008647
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

successfully deployed the CA Microgateway onto OpenShift PaaS ecosystem and integrated with a PostgreSQL Database. Connectivity works, but the following error is reported: 

 

WARNING: 9104: "Perform JDBC Query" assertion failed due to: Bad SQL Grammar: ERROR: relation "template_registrar" does not exist 
Are there any other steps that must be performed in PostgreSQL to be used by CA Microgateway?

Environment:
CA Microgateway 1.0 with PostgreSQL
Cause:

There are a couple of possible causes:

1. One of the reasons for failure is that the schema of the database must be created by a sysadmin,  

2. The customer may have just installed the sskar file (solution kit) or used an external db or did not use the default microgateway container with the configured postgres db image. 

3. Another possible reason would be that the DB USER that was given to the Microgateway container didn’t have the sufficient rights to create the table. 

docker logs <microgateway container id> > microgateway.log)  - may reveal more information

Resolution:

We can confirm that the released docker image caapim/microgateway: 1.0.00 has the file /opt/docker/rc.d/scalerDbSchemaPostgreSql.sql which creates the table: 

sh-4.2$ cat /opt/docker/rc.d/scalerDbSchemaPostgreSql.sql 
-- 
-- PostgreSQL version of Quick Start Template Registrar database creation script. 
-- 

DROP TABLE IF EXISTS template_registrar; 

CREATE TABLE template_registrar ( 
name varchar(255) NOT NULL, -- same as published_service name field 
uri varchar(255) NOT NULL, -- max size is 255 for unique index 
time varchar(32) NOT NULL, 
template TEXT NOT NULL, 
PRIMARY KEY (name) 
); 

ALTER TABLE template_registrar ADD CONSTRAINT uri_ID UNIQUE (uri);