How to Connect to Google Cloud Spanner

Connect Using the JDBC URL

All cloud providers, like AWS, Oracle or Google allows to get the JDBC URL in the cloud console. In DbSchema Connection Dialog choose 'Manually Edit the JDBC URL' and copy the URL.

Connect to Google Cloud Spanner in the Cloud

Connect to a Google Cloud Spanner Server

Connecting to the database will require to use the Connection Dialog as explained in the Connection Dialog.

In the DbSchema connection dialog you will have to specify the ProjectId, InstanceId and DatabaseId which can be fond in the Google console.

Google Cloud Spanner Console

Also you will have to set an GOOGLE_APPLICATION_CREDENTIALS pointing to the authentication json file, which is generated on Google Credentials Console.

Generate Authentication JSON File

. The simplest way to get a credential for this purpose is to create a Service account key in the Google API Console:
  • Go to the API Console Credentials page.
  • From the project drop-down, select your project.
  • On the Credentials page, select the Create credentials drop-down, then select Service account key.
  • From the Service account drop-down, select New Service Account.
  • Name the service account and select Role as Project Owner from the drop down.
    Create Google Cloud Spanner Account
  • For Key type, select the JSON key option, then select Create. The file automatically downloads to your computer.
  • Put the *.json file you just downloaded in a directory of your choosing.
  • Set the System Environment Variable GOOGLE_APPLICATION_CREDENTIALS to the path of the JSON file downloaded.
    Create Google Cloud Spanner Account
Tip Firewalls & anti-viruses may block database connections. Read How to enable Firewall connections.