rudrasiva86
rudrasiva86

Reputation: 583

Pivotal Cloud Foundry - Connecting to external oracle database

I am creating a Spring boot application that connects to an oracle database which is not managed by (or residing outside) the PCF. In my local development environment i configured the database connection details in application.properties file. Could someone share how to achieve this in PCF without hard-coding the details in application.properties.

Upvotes: 3

Views: 7843

Answers (1)

Shiva
Shiva

Reputation: 6885

Cloud Foundry provides you with something called as User Provided Service, that allows you to connect any other service like Oracle database or a legacy ERP system etc. that is not running on CF.

So in your CF environment you can create a Oracle User Provided Service like

cf create-user-provided-service oracle-database-service -p '{"uri":"oracle://root:[email protected]:1521/mydatabase"}'

Then you can bind it to your existing application on CF using

cf bind-service <app name> <service name>

eg : cf bind-service my-application oracle-database-service

and then just restart the app using cf restart

PS: you will still need to have the appropriate JDBC driver in your application, you can always use Maven or gradle for it, or download one from the official site and include it in your project

Link to Oracle site for JDBC driver : http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html

Upvotes: 9

Related Questions