0
votes

I currently have my database credentials saved as ENV Variables. But I want to change that so the database will be a backing service.

Env Variables

SPRING_DATASOURCE_driverClassName: oracle.jdbc.OracleDriver

//sample url to mask mine
SPRING_DATASOURCE_URL: jdbc:oracle:thin:@//spring.guru.csi0i9rgj9ws.us-east-1.rds.a‌​mazonaws.com:1521/OR‌​C
SPRING_DATASOURCE_USERNAME: UserAdmin
SPRING_DATASOURCE_PASSWORD: p4ssw0rd
SPRING_DATASOURCE_initialize: false

Script above works and have database connection when running on cloud foundry.

_ _ - _ _ - _ _

Here is the script I input in my command prompt, where I create a service and bound it to my application

cf cups OracleTest -p 'username, password, url'

Example Link1 Example Link2

Once I fill out all the credentials, bind my application to the service, and restage my application. I do not receive any database connection.

My Attempt on CF

Example

//for uri I also tried 
jdbc:oracle:thin:@//spring.guru.csi0i9rgj9ws.us-east-1.rds.a‌​mazonaws.com:1521/OR‌​C

--Do I need some java configuartions along with this?

2

2 Answers

0
votes

I did a quick search. I couldn't find an example where you can set the drivername in the CUPS service. You may try removing it from the CUPS definition.

Here is another way of setting the CUPs service - Pivotal Cloud foundry Access Service from Java App

Give it a try

0
votes

I removed the unnecessary parameters and used the follow

cf cups OracleDB -p '{"jdbcUrl":"jdbc:oracle:thin:[username]/[password]@//[host]:[port]/[service]"}'

So instead of adding each attribute one by one. I found out that it can accept one of the following.

Oracle
The connector will check for:

uri or uris using the scheme oracle

jdbcUrl field in credentials using the scheme oracle

oracleUri, oracleuri, oracleUrl, or oracleurl fields in credentials

I choose jdbc and added credentials in the url.