简体   繁体   中英

How to connect to Amazon RDS MySQL database from an springboot applicaiton deployed on PCF?

Is there any special configuration required for connecting amazon rds mysql database with a spring boot application which is deployed on PCF(Pivotal Cloud Foundry). when i try to bind via auto-configuration i get error stating unable to acquire jdbc connection.

You have to create a user provider service using cloud foundry commands.

  1. Create a JSON file and fill the database connection information.
  2. Use cups command to map the JSON file path location and create the service.
  3. Use VCAP_SERVICES from environment variable to use in the application.
  4. From Amazon RDS MySQL, you should open traffic for App instance(s) to access the database.
  5. This point may work. From my view, you can point Diego Cells IP addresses in inbound rule to open traffic for Amazon MySQL Security Group. Because App instances are running in Diego Cells.

Create User-Provided Service using below command:

cf cups SERVICE_NAME -p "uri"

URI format should be as given below:

jdbc:mysql://HOST:PORT/SCHEMA_NAME?user=USERNAME&password=PASSWORD

When you will bind this service to your application, Spring Boot will automatically detect the database and wil

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM