You can access deployments from a client application with the EDB Postgres service.
About this task
For more information, see Connecting from an application in the EDB Postgres documentation.
You need the EDB Postgres instance name to
connect to a database.
Procedure
Follow these steps to obtain the instance name:
- From the Instances tab of the Cloud Pak for Data console, open the Details
page for your EDB Postgres
instance.
- Note the value of the EDB Postgres
instance name. The names used for connecting will be in the following format:
- instance_name
-rw
- instance_name
-ro
- instance_name
-r
instance_name-rw provides read and write access.
instance_name-ro and
instance_name-r only provide read access. Use the connection
required for your environment.
- Retrieve your instance credentials. Credentials are stored as Kubernetes secrets.
- Run the following command to retrieve your instance credentials:
- In the output, find your secrets which will be in the following
format:
instance_name-edb-db-appinstance_name-edb-db-superuser
Use
the instance_name-edb-db-app secret for typical workloads. Use
the instance_name-edb-db-superuser secret for administrative
purposes that require greater privileges.
- Extract the username and password from
the secret. You can extract this information from either the OpenShift® Container Platform console or the command line:
- Using the OpenShift Container Platform
- Click Secrets, then select the secret you require and copy the
username and password values.
- Using the command line
- Run the following command to extract the username and
password:
oc get secret/edb0210-1-edb-db-app -o jsonpath='{.data.username}{"\n"}'
oc get secret/edb0210-1-edb-db-app -o jsonpath='{.data.password}{"\n"}'
The output
will be an encoded string. Run the following command to decode it:
echo "<encoded_string>" | base64 -d
Results
You can now use the username and password to access
the EDB Postgres instance.
What to do next
Start using your EDB Postgres
instances. See Working with EDB Postgres databases.