cancel
Showing results for 
Search instead for 
Did you mean: 

Issue in connecting to PostgreSQL with Fiori Project

0 Kudos
256

Dear Experts,

Background:

We are working with an S-User with SAP BTP. The application is developed in the Business Application Studio and we are using a PostgreSQL instance from another subaccount as our data bank.

We have been attempting to deploy our application to our dev space. Instead of using SAP HANA DB as our data bank we wanted to use PostgreSQL. That however hasn’t worked so far, despite following multiple tutorials and guides.

Problem:

Once the application is successfully deployed we check if we can view the data. Each entity has ist own set of data.

When the application is started locally with the command „cds watch“ and a service endpoint is selected from the ones below:

The following error message is shown instead of the expected data:

When the application and its endpoints are accessed via Cloud Foundry, the following error message is displayed:

The metadata however can be viewed without any issue.

The instance for the data bank hast he status „created“ as can be seen below:

The service binding is created as well:

Note:

When deploying the application using the npx commands „npx cds-dbm deploy“ and „npx cds-dbm load --via delta“, they throw the following error:

Below you can find the relevant coding.

Mta.yaml:

---

_schema-version: '3.1'

ID: eventapp

version: 1.0.0

description: "A new CAP project."

parameters:

enable-parallel-deployments: true

build-parameters:

before-all:

- builder: custom

commands:

- npx -p @sap/cds-dk cds build --production

modules:

- name: eventapp-srv

type: nodejs

path: gen/srv

parameters:

buildpack: nodejs_buildpack

build-parameters:

builder: npm-ci

provides:

- name: srv-api # required by consumers of CAP services (e.g. approuter)

properties:

srv-url: ${default-url}

requires: []

Package.json:

{

"name": "eventapp",

"version": "1.0.0",

"description": "A new EventApp project.",

"repository": "https://git-global.***.org/***/eventapp-2.0.git",

"license": "UNLICENSED",

"private": true,

"scripts": {

"start": "cds run",

"watch-admin-manage-events": "cds watch --open admin-manage-events/webapp/index.html?sap-ui-xx-viewCache=false",

"undeploy": "cf undeploy eventapp --delete-services --delete-service-keys --delete-service-brokers",

"build": "rimraf resources mta_archives && mbt build --mtar archive",

"deploy": "cf deploy mta_archives/archive.mtar --retries 1",

"watch-admin-manage-sessions": "cds watch --open admin-manage-sessions/webapp/index.html?sap-ui-xx-viewCache=false",

"watch-admin-manage-users": "cds watch --open admin-manage-users/webapp/index.html?sap-ui-xx-viewCache=false"

},

"engines": {

"node": "^16.0.0"

},

"dependencies": {

"@sap/cds": "6.1.3",

"cds-dbm": "^0.0.36",

"cds-pg": "^0.1.36",

"express": "^4"

},

"devDependencies": {

"cds-dbm": "^0.0.36",

"mbt": "~1.2.1"

},

"cds": {

"requires": {

"db": {

"kind": "database"

},

"database": {

"impl": "cds-pg",

"dialect": "plain",

"model": [

"srv"

],

"credentials": {

"username": "***",

"password": "***",

"hostname": "postgres-***.eu-central-1.rds.amazonaws.com",

"dbname": "***",

"port": "***",

"uri": "postgres://***@postgres-***1.rds.amazonaws.com:***",

"sslcert": "-----BEGIN CERTIFICATE-----***-----END CERTIFICATE----------BEGIN CERTIFICATE-----***-----END CERTIFICATE-----",

"sslrootcert": "-----BEGIN CERTIFICATE-----***-----END CERTIFICATE----------BEGIN CERTIFICATE-----***-----END CERTIFICATE-----"

}

}

},

"migrations": {

"db": {

"schema": {

"default": "public",

"clone": "_cdsdbm_clone",

"reference": "_cdsdbm_ref"

},

"deploy": {

"tmpFile": "tmp/_autodeploy.json",

"undeployFile": "db/undeploy.json"

}

}

}

},

"sapux": [

"app/admin-manage-events",

"app/admin-manage-sessions",

"app/admin-manage-users"

]

}

Thanks in advance for your apt responses.

Y..U, N. K.

Accepted Solutions (0)

Answers (1)

Answers (1)

venkateshkasira
Associate
Associate
0 Kudos

Hi,

I see extensive tutorials / blogs. may be below links can help

There are some example apps already using cds-dbm in combination with cds-pg:

There are also some blogposts in the SAP Community showcasing the functionality of cds-dbm: