Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasource binging in VCAP_SERVICES result in multiple DataSources #103

Open
dietzsch opened this issue Oct 22, 2020 · 0 comments
Open

Datasource binging in VCAP_SERVICES result in multiple DataSources #103

dietzsch opened this issue Oct 22, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@dietzsch
Copy link

So far we are using the Spring Cloud Connector with a datasource in VCAP_SERVICES like this:

  "oracle-mysql": [
    {
      "label": "oracle-mysql",
      "provider": null,
      "plan": "production",
      "name": "vmaasBrokerMySql",
      "tags": [
        "database",
        "mysql"
      ],
      "instance_name": "vmaasBrokerMySql",
      "binding_name": null,
      "credentials": {
        "hostname": "xx.xx.xx.xx",
        "password": "password",
        "readonly": false,
        "port": 38010,
        "dbschema-name": "db_name",
        "uri": "mysql://username:[email protected]:38010/db_name?connectTimeout=20000&useSSL=true&verifyServerCertificate=false",
        "username": "username"
      },
      "syslog_drain_url": null,
      "volume_mounts": []
    }
  ]

With Spring Cloud Connector this has worked the way that one DataSource was returned by the CloudConfig. When we try to switch to java-cfenv this doesn't work any more as the datasource binding end up with two datasources, one based on the label and one based on the name. At the end we receive an exception as below:

2020-10-21T14:35:51.564+02:00 [APP/PROC/WEB/0] [OUT] Caused by: java.lang.IllegalArgumentException: No unique database service found. Found database service names [vmaasBrokerMySql, vmaasBrokerMySql]
2020-10-21T14:35:51.564+02:00 [APP/PROC/WEB/0] [OUT] at io.pivotal.cfenv.jdbc.CfJdbcUrlCreator.throwExceptionIfMultipleMatches(CfJdbcUrlCreator.java:97)
2020-10-21T14:35:51.564+02:00 [APP/PROC/WEB/0] [OUT] at io.pivotal.cfenv.jdbc.CfJdbcUrlCreator.findJdbcService(CfJdbcUrlCreator.java:87)
2020-10-21T14:35:51.564+02:00 [APP/PROC/WEB/0] [OUT] at io.pivotal.cfenv.jdbc.CfJdbcEnv.findJdbcService(CfJdbcEnv.java:46)

From my perspective either the first datasource created should be returned (then it would need a order which defines the preference) or the decision is not made based on name/labels, but the URI itself, as this would clearly distinguish between Oracle and MySQL.

@pivotal-david-osullivan pivotal-david-osullivan added the bug Something isn't working label Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants