Insights Hub How to connect PostgreSQL Database to my local pgAdmin management tool?

2023-04-12T15:16:48Z
Developer Tools

Summary


Details

I want to connect my PostgreSQL service instance to my local PgAdmin For rapid development on my local machine.

Please provide the steps how I can connect my Mindsphere PostgreSQL service Instance to my local PgAdmin instance?

Solution

Please follow the below steps to connect and manage the PostgreSQL service instance locally.

Note: 

  • you must have an application bound to the PostgreSQL service.
    • cf ssh support must be enabled in the platform.

      Step 1: Get application environment info and take note of host, name, username, password

      to get environment info of the app command: cf env {app_name}

      Step 2: Connect by ssh command:

      cf ssh {app_name} -L {local_port}:{host}:{port} for example: $ cf ssh postgresql-app -L 5433:d67901c.service.dc1.a9svs:5432

      Step 3: Now open the PgAdmin application server on your machine/PC.

      Step 4: Create a local server to connect and manage the database.

      Step 5: Enter name in the general tab of "create server". 

      Provide host name, port number maintenance database, username, and password (which you already received from the application environment variable in step 1). Please refer to below screenshot, then click on save.

      Now you can use your PostgreSQL service in your local PgAdmin.



      Notes

       For any questions or support in this matter, contact us through the support centre.

      For additional information regarding how to make a service instance locally available, please visit following URL:

      https://developer.mindsphere.io/paas/a9s-postgresql/using.html#make-a-service-instance-locally-available

      Notes

      KB Article ID# PL8537718

      Contents

      SummaryDetails

      Associated Components

      PostgreSQL