Technical Articles
CAP with PostgreSQL DB alternate to HANA Cloud DB – Part 1
The intend of this blog to give you an alternate DB selection to develop your CAP application with an alternate postgreSQL db other than HANA Cloud.
It is very important depending your needs and clients use case. If your use case has only transactional data you will be leaning to opt out to postgreSQL db oppose to a heavier usage of HANA Cloud db, if there is no desire to support analytics use case.
This will provide a How-to guidance to setup a CAP project with postgreSQL db as your persistence layer.
- Configure BTP global account
- Create CAP project with postgreSQL
- Using DBeaver to connect to postgreSQL
Step 1: Configure BTP global account
1. Ensure you have BTP Global Administrators Access
Role Collection – Global Account Administrator
2. Create or Re-use existing subaccount, assign ‘PostgreSQL – Hyperscaler Option’ entitlements to your sub account
3. Create a new space within the subaccount with cloud foundry runtime
Your subaccount should now be setup to create CAP project with postgreSQL DB.
Step 2: Create CAP Project with PostgreSQL
1. From BAS, create a CAP project using the template wizard, from command pallete, click on ‘Start’ create a new CAP project using this wizard.
2. Enter project name “pg-cap”, add feature “MTA based Business Technology Platform Deployment”, add sample content “Basic Sample Files”, and click on “Finish” button
3. Navigate to newly created CAP project “pg-cap”, and open up package.json add the following libraries within the dependecies node then run npm install from your terminal
-
@cap-js/postgres”: “^1.2.1”
- @sap/xssec”: “^3”,
- “passport”: “latest”,
4. Define resources and configure mta.yaml file
- create new postgresql and xsuaa resource
xs-security.json
- create postgresql resource
pg-options.json
- update the build parameters
pgbuild.sh




Hello Ramon Lee,
thanks for the blog.
Unfortunately, the configuration files are screenshots in the blog.
Could you specify them so that you can use them with copy and paste?
the part about editing the yaml file is difficult to understand.
mta.yaml
package.json
xs-security.json
okay, I've got it right now
Best regards Dirk
here the pgbuild.sh formatted
Build yaml is possible.
But I can't deploy.
I get the following error
Hi Dirk,
Not sure why you are getting JAVA related deployment issue.
The above CAP project is based on CloudFoundry runtime using mtar as an deployment file.
Regards,
RL
Hello Ramon,
yes, I try to deploy it on CloudFoundry and use Notes.JS and deploy the project with a mtar file.
regards Dirk