IBM Cloud Databases - Structured Ideas

This Ideas portal is being closed.  Please enter new idea at

Allow services to be bound to a project like bluemix applications where the credentials are passed in via VCAP_SERVICES

Couldn’t we follow the same pattern as Bluemix apps where services would be bound to the app (DSX project) and use the VCAP_SERVICES environment variable?

vcap_services = os.getenv("VCAP_SERVICES")
vcap = json.loads(vcap_services)

# Cloudant details

cloudant_credentials = vcap['cloudantNoSQLDB'][0]['credentials']

CL_HOST = cloudant_credentials['host']
CL_USER = cloudant_credentials['username']
CL_PASS = cloudant_credentials['password']
CL_URL = cloudant_credentials['url']

  • chris snow
  • Dec 14 2018
  • Under Consideration
Why is it useful?
Who would benefit from this IDEA?
How should it work?
Idea Priority
Priority Justification
Customer Name
Submitting Organization
Submitter Tags
  • Attach files
  • chris snow commented
    December 14, 2018 17:58

    It may make most sense to apply services to the spark service so that we can still access the vcap_services variable from a spark submit job (I.e. Not using Dsx)

  • chris snow commented
    December 14, 2018 17:58

    Here's an example java (spring) config for connecting to a data source via vcap services:

    public class Configuration {
    static class CloudConfiguration {

    public DataSource dataSource() {
    CloudFactory cloudFactory = new CloudFactory();
    Cloud cloud = cloudFactory.getCloud();
    String serviceID = cloud.getServiceID();
    return cloud.getServiceConnector(serviceID, DataSource.class, null);

  • Dejan Glozic commented
    December 14, 2018 17:58

    This already exists in a rudimentary form. Projects already have certain services (Spark, Machine Learning) that are bound to projects so that all project members can use them. Notebooks use this today, and so does the upcoming Machine Learning model builder. We are going to push more in this direction in the future.

  • chris snow commented
    December 14, 2018 17:58

    @dejan is there an interim solution we could provide where a field is provided in project settings for pasting a VCAP_SERVICES json string and then setting the VCAP_SERVICES environment variable based on that? We could maybe put this in a section of project settings called advanced.

  • Daniel Debrunner commented
    December 14, 2018 17:58

    Exactly what I need!

  • chris snow commented
    December 14, 2018 17:58

    The benefits of this approach:

    - same code can be used in notebooks and bluemix apps
    - variables aren't hardcoded into notebooks

  • Philippe GREGOIRE commented
    December 14, 2018 17:58

    Getting access to `project-lib` tokens would allow to then get access to other resources such as COS objects and Connection artifacts too.
    Currently one has to explicitly paste that in the notebook code even though it would be a %hidden_cell

  • Guest commented
    December 14, 2018 17:58
  • Sanjay Joshi commented
    December 14, 2018 17:58

    Love embracement of loose coupling !