|
1 | | -# Cloud SQL sample for Google App Engine |
| 1 | +# Cloud SQL sample for Google App Engine (Java 8) |
2 | 2 |
|
3 | | -<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=appengine-java8/cloudsql/README.md"> |
4 | | -<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a> |
| 3 | +For instructions on using Google App Engine and Cloud SQL, please see |
| 4 | +[Connecting to Cloud SQL from App Engine][0]. |
5 | 5 |
|
| 6 | +For a complete example of a web application connecting to Cloud SQL, |
| 7 | +check out the sample applications listed under the [Cloud SQL samples][1]. |
6 | 8 |
|
7 | | -This sample demonstrates how to use [Cloud SQL](https://cloud.google.com/cloudsql/) on Google App |
8 | | -Engine standard Java 8 |
9 | | - |
10 | | -## Setup |
11 | | - |
12 | | -* If you haven't already, Download and initialize the [Cloud SDK](https://cloud.google.com/sdk/) |
13 | | - |
14 | | - `gcloud init` |
15 | | - |
16 | | -* If you haven't already, Create an App Engine app within the current Google Cloud Project |
17 | | - |
18 | | - `gcloud app create` |
19 | | - |
20 | | -* If you haven't already, Setup |
21 | | -[Application Default Credentials](https://developers.google.com/identity/protocols/application-default-credentials) |
22 | | - |
23 | | - `gcloud auth application-default login` |
24 | | - |
25 | | - |
26 | | -* [Create an instance](https://cloud.google.com/sql/docs/mysql/create-instance) |
27 | | - |
28 | | -* [Create a Database](https://cloud.google.com/sql/docs/mysql/create-manage-databases) |
29 | | - |
30 | | -* [Create a user](https://cloud.google.com/sql/docs/mysql/create-manage-users) |
31 | | - |
32 | | -* Note the **Instance connection name** under Overview > properties |
33 | | - |
34 | | -## Running locally |
35 | | - |
36 | | -```bash |
37 | | -$ mvn clean appengine:run -DINSTANCE_CONNECTION_NAME=instanceConnectionName -Duser=root -Dpassword=myPassword -Ddatabase=myDatabase |
38 | | -``` |
39 | | - |
40 | | -## Deploying |
41 | | - |
42 | | -```bash |
43 | | -$ mvn clean package appengine:deploy -DINSTANCE_CONNECTION_NAME=instanceConnectionName -Duser=root |
44 | | --Dpassword=myPassword -Ddatabase=myDatabase |
45 | | -``` |
46 | | - |
47 | | - |
48 | | -## Cleaning up |
49 | | - |
50 | | -* [Delete your Instance](https://cloud.google.com/sql/docs/mysql/delete-instance) |
| 9 | +[0]: https://cloud.google.com/sql/docs/mysql/connect-app-engine#java |
| 10 | +[1]: ../../cloud-sql/ |
0 commit comments