All service related information is exposed through VCAP_SERVICES environment variable. The content of this variable is JSON such as:
{"mysql-5.1":[{"name":"mysql-1fd96","label":"mysql-5.1","plan":"free","credentials":{"node_id":"mysql_node_7","hostname":"172.30.48.26","port":3306,"password":"jmsdmnfsdfn","name":"df18176fc6336456db8907cfd7565e311","user":"u4HUGiJwB5l5A"}}]}
You application can connect to database using this information. If you are using Java, we have runtime that simplifies the access (see https://github.com/cloudfoundry/vcap-java/tree/master/cloudfoundry-....