Pivotal Cloud Foundry - Connecting to external oracle database

徘徊边缘 提交于 2019-12-10 19:27:11

问题


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.


回答1:


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:secret@dbserver.example.com: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



来源:https://stackoverflow.com/questions/44500674/pivotal-cloud-foundry-connecting-to-external-oracle-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!