brightec
Home Services Projects Blog About Contact

Setting up Cloud SQL in Java

How to set up Cloud SQL in Java Brightec illustration
Are you setting up Cloud SQL within a Java project using Android Studio? Read on - and hopefully we can point you in the right direction!

Cloud SQL

Cloud SQL is a fully-managed database service. It makes it easy to set up, maintain, manage and administer your relational MySQL database in the cloud: https://cloud.google.com/sql/

The big switch

To set up our database we used a database management application for the easy interface (https://www.sequelpro.com/). I’m sure you’ll have your favourite way of setting up SQL databases. To interact with the database you need a connection:

Gradle dependency

compile 'com.google.cloud.sql:mysql-socket-factory:1.0.4'​

A convenient util method

Appengine-web.xml

Once you have your database connection you can then perform operations utilising the standard Java APIs. We used it in combination with Google Cloud Endpoints. For more information on Cloud Endpoints take a look here. For example:

User Authentication for Cloud SQL 1 Android
User Authentication for Cloud SQL
When using Cloud SQL for databasing on a project, we needed a solution to ensure the right people could access the right information.

Looking for something else?

Search over 200 blog posts from our team

Want to hear more?

Subscribe to our monthly digest of blogs to stay in the loop and come with us on our journey to make things better!