Connection to Your SAP BTP PostgreSQL Database

Connection to Your SAP BTP PostgreSQL Database

  1. Install the Cloud Foundry CLI (if needed)
    If you don’t already have the cf CLI on your machine, follow the installers or download a compressed binary from the V8 CLI Installation Guide:
    https://github.com/cloudfoundry/cli/wiki/V8-CLI-Installation-Guide#installers-and-compressed-binaries.

  2. Authenticate
    Log in to your Cloud Foundry organization via SSO:

    cf login --sso -a <CF_API_ENDPOINT>
    

    You can find <CF_API_ENDPOINT> under Overview of your Subaccount in the BTP cockpit.

  3. Enable SSH on your app
    Using the application name defined in your downloaded vars.yml or the whole name of application including postfix of -app then run:

    cf enable-ssh <app-id from vars.yml>-app
    
  4. Restart the app
    Apply the SSH setting by restarting your application:

    cf restart <app-id from vars.yml>-app
    
  5. SSH into the container
    Once the app is running again, open a shell on the instance:

    cf ssh <app-id from vars.yml>-app
    
  6. Extract database connection details
    Inside the container, run this to print the host, port, username and database name:

    echo $VCAP_SERVICES \
      | jq -r '.["postgresql-db"][0].credentials 
          | "REMOTE_HOST=\(.hostname)\nREMOTE_PORT=\(.port)\nDB_USER=\(.username)\nDB_NAME=\(.dbname)"'
    

    Alternatively, you can copy these values directly from your Figaf DB instance in the BTP cockpit.

  7. Connect with psql
    Use the values you retrieved to start a PostgreSQL session:

    psql -h <REMOTE_HOST> -p <REMOTE_PORT> -U <DB_USER> <DB_NAME>
    • Related Articles

    • Unable to start Figaf App because of missing Database

      We experienced an issue that the Postgresql figaf-db did not respond when trying to deploy Figaf Tool. Also the Figaf app was crashed because of something. Once we ran CF deploy we got the error For application 'xxx-figaf-app': For service ...
    • Postgres Database Resources Monitor

      Monitoring the health and performance of your PostgreSQL database is not just a technical requirement—it’s an investment in your users’ experience. A well-tuned, responsive database minimizes delays, ensuring smooth interactions, reducing timeouts, ...
    • Configure SAP Alert Notification service

      1. Go to Service Marketplace and find Alert Notification service. 2. Finish installation wizard and create the instance. 3. Go to your alert-notification instance and configure subscriptions. 4. Create conditions based on the resources that interest ...
    • Connect to SAP Integration Suite /Cloud Foundry

      To connect to SAP Cloud Foundry we have enabled a new way of connecting using SAML. This is because the public APIs of SAP Cloud Integration is not as good as the private APIs used in the Web. The guide video that shows how to connect Figaf to an ...
    • Create Service Keys for SAP CPI Cloud Foundry

      For SAP CPI Cloud Foundry you have an option to use Service Keys to send messages. The Figaf Tool will not test the properties are correct before running tests. We need to create keys for both API and for Integration flow API access To create a ...