I’m just starting out with CloudFoundry and I understand that the only way to be able to execute a sql dump against a db is to
- Create MySQL service
- Bind Service
- Tunnel to the service
But I’m not getting any luck on the last part. I followed the directions from cloud foundry forum discussion
I select option 1. None But I just don’t know how run
mysql –protocol=TCP –host=localhost –port=10000 –user=ub2sCBQ0mGsVZ –password=pRXana7vEOX0C df83386088ffc4f8d8cf288791d22fb99 < sample.sql
from command line (Windows) or from SQLyog.
The other part of the question is of course once I am able to create the database and the tables and insert data into them. How does my webapp need to connect to the database?
On one hand I think I know the answer as described here
But I can’t believe that this is the only way. This is damn difficult with Spring because I would have to read the env in before the entire Spring/Hibernate machinery starts creating the needed beans. Is there an example of less complex way to do this ?
if you are using Windows I would suggest using MySQL workbench to connect using the credentials provided when opening the tunnel using VMC. You can download it from the MySQL website here;
https://www.mysql.com/products/workbench/
When deploying a Spring application that uses a MySQL service you can have it automatically configure the database connection in your app. See the following page for details;
http://docs.cloudfoundry.com/frameworks/java/spring/spring.html#determining-whether-your-application-can-be-auto-configured