2019 Aug 07 3:37 PM - edited 2024 Feb 03 5:05 PM
Hi Community,
because of the new BYOA-concept of SAP I tried to create a user-provided service instance of an AWS-postgresql-db-service to consume it from a node.js app. Unfortunately something goes wrong with the credentials or the uri. Has anyone a working example or knows, what wrong in my case? I followed this blog post: Blogpost
{
"username": "postgres",
"password": "*********",
"db": "postgres",
"hostname": "elb-postgresql.c8uizrkzmtox.eu-central-1.rds.amazonaws.com",
"port": "5432",
"uri": "jdbc:postgresql://elb-postgresql.c8uizrkzmtox.eu-central-1.rds.amazonaws.com:5432/postgres?user=postgres&password=*********"
}
To get the URI in my node.js app I'm doing the following: Is this still right, or do I have to adapt it?
function returnUriToDB() {
var uri = '';
if (process.env.VCAP_SERVICES) {
// running in cloud
-----------> uri = xsenv.cfServiceCredentials('cf_elb_postgres').uri;
console.log('+++++ in returnUriToDB');
} else {
console.log('+++++ running locally is not supported');
}
return uri;
}
Furthermore I don't know, if I have to adapt the resource in my mta.yaml:
- name: cf_elb_postgres
type: postgresql
The error when trying to load data says:
[...] The following problem occurred: error - Error accessing ObjectGroups Table or DB: {"errno":"ENOTFOUND","code":"ENOTFOUND","syscall":"getaddrinfo","hostname":"postgresql","host":"postgresql","port":5432},500,Internal Server Error
Seems as if hostname has not the right parameter of the credentials?
Best regards!
Solved it by copying the form of the uri of the deprecated postgres-services instead of the one in the blog post: Form: "uri": "postgres://username:pw@hostname:port/dbname"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Paige Ola
You could choose to configure the connection parameters based on your requirement, in the blog I have chosen to use JDBC connection URI for my java application. If you are building a Node.js application you could just use the hostname and construct a suitable URI while creating the User-Provided Service.
Thanks
Suhas
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.