Skip to Content
avatar image
Former Member

Connect to database in SAP Cloud Platform from Python App

I have connected my database instance in SAP CP using Python app. I am using pyhdb library to connect. For that, I opened the tunnel and it works fine. The parameters I passed to pyhdb is my (IP address as host, port 30015, my user, my password)

But when I try to deploy my same app using cloud foundry, I get connection refused error.
Any help or pointers?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 29, 2017 at 03:17 PM

    Hi Prathamesh,

    Your app needs to deal with different configurations when you deploy locally or in the cloud environment.
    When you deploy on CF the manifest file needs to point to the related backing service and from your app perspetive happens on the localhost instead of your tunnel. You need to read the environment variables and look for the VCAP_SERVICES. There you will get the backing services assigned to your app with all connection details, like port numbers, users, password, etc. So you don't need to worry about those when your app runs.

    Check this blog to see how a local connection is made to MongoDB using NodeJS.


    Add comment
    10|10000 characters needed characters exceeded