GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java-docs-samples/flexible/cloudsql at master · stephanj/java-docs-samples

Expand file tree

/

cloudsql

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

cloudsql

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
src/main
src/main
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Cloud SQL sample for Google Managed VMs

This sample demonstrates how to use Cloud SQL on Google Managed VMs.

Setup

Before you can run or deploy the sample, you will need to do the following:

  1. Create a Second Generation Cloud SQL instance. You can do this from the Cloud Console or via the Cloud SDK. To create it via the SDK use the following command:

     $ gcloud sql instances create YOUR_INSTANCE_NAME \
         --activation-policy=ALWAYS \
         --tier=db-n1-standard-1
    
  2. Set the root password on your Cloud SQL instance:

     $ gcloud sql instances set-root-password YOUR_INSTANCE_NAME --password YOUR_INSTANCE_ROOT_PASSWORD
    
  3. Use the MySQL command line tools (or a management tool of your choice) to create a new user and database for your application:

    $ mysql -h [IP Address of database] -u root -p mysql> create database YOUR_DATABASE; mysql> create user 'YOUR_USER'@'%' identified by 'PASSWORD'; mysql> grant all on YOUR_DATABASE.* to 'YOUR_USER'@'%';

  4. Set the connection string environment variable in src/main/appengine/app.yaml

Running locally

Export local variables
$ export SQL_URL="jdbc:mysql://google/YOUR-DB-NAME?cloudSqlInstance=YOUR-INSTANCE-NAME&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=USERNAME&password=PASSWORD"
$ mvn clean jetty:run

Deploying

$ mvn clean appengine:deploy
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.