Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I created a postgresql instance from marketplace in my space whose instance name is : stack-uaa-postgresql

I need to connect to it from the console to execute sql queries .

I followed this document :

https://docs.cloudfoundry.org/devguide/deploy-apps/ssh-services.html

and executed this command :

cf create-service-key stack-uaa-postgresql postgresqlkey

and then validated it using :

cf service-key stack-uaa-postgresql postgresqlkey

and I got the following response :

 {

 "dbname": "removed",

 "hostname": "removed",

 "password": "removed",

 "port": "33784",

 "ports": {

  "5432/tcp": "33784"

 },

 "uri": "removed",

 "username": "removed"

I have removed values. 

But the moment I try to do tunneling using ssh in my postgresql using below command it is displaying me exception :

> cf ssh -L 63306:<username>:<password>@<host internal ip>:33784

> stack-uaa-postgresql

FAILED App stack-uaa-postgresql not found

Please help me out with this.

1 Answer

0 votes
by (11.7k points)

I know it’s confusing, but for tunneling, you need to deploy an actual app to the space where your database is located and you are tunneling to that app via the cf command (I know it makes no sense, why you need an app there, but as far as I know there is no other way):

cf ssh -L localhost:<localport>:<remotehost-ip:<remoteport> <app-name> -N

Also, don’t forget to call cf enable-ssh <app-name> (one time) for the app you will use for the tunnel.

If you want to get more insights into SQL, check out this SQL Course from Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Mar 19, 2020 in AWS by chandra (29.3k points)
0 votes
1 answer
asked Jan 24, 2021 in BI by Chris (11.1k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...