Pivotal Cloud Foundry-连接到外部Oracle数据库 [英] Pivotal Cloud Foundry - Connecting to external oracle database

查看:134
本文介绍了Pivotal Cloud Foundry-连接到外部Oracle数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个Spring引导应用程序,该应用程序连接到不由PCF管理(或不在PCF外部)的oracle数据库.在我的本地开发环境中,我在application.properties文件中配置了数据库连接详细信息.有人可以分享如何在PCF中实现此目标,而无需在application.properties中对细节进行硬编码.

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.

推荐答案

Cloud Foundry为您提供了一个称为用户提供的服务"的功能,它允许您连接任何其他服务,例如Oracle数据库或旧版ERP系统等.在CF上运行.

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.

因此,在您的CF环境中,您可以创建Oracle用户提供的服务,例如

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"}'

然后您可以使用

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

例如:cf bind-service my-application oracle-database-service

,然后使用cf restart

PS:您仍然需要在应用程序中具有适当的JDBC驱动程序,您始终可以使用Maven或gradle,或者从官方站点下载一个驱动程序并将其包含在您的项目中

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

链接到Oracle网站以获取JDBC驱动程序: http://www.oracle.com/technetwork/database /enterprise-edition/jdbc-112010-090769.html

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

这篇关于Pivotal Cloud Foundry-连接到外部Oracle数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆