How to establish Google Cloud Spanner connection
1. Register an instance of Cloud Spanner Database.
To register your Spanner database in Cloud Spanner Manager click Server|Register Cloud Spanner Instance… item in the Main menu.
You need to enter your Google Cloud Platform project ID into the Project ID field and Cloud Spanner database instance into the Instance ID field.
Instance Alias is a name you want to associate with the registered Spanner instance, you can type any text or leave default value. You see this name in DB Explorer.
2. Set up credentials.
2.1. Cloud Spanner Manager shows a warning if Google application credentials not found in your System.
In this case please follow the directions below.
2.2. Visit the APIs & Services page in the Google Cloud Platform Console and click Credentials.
2.3. Click Create credentials and choose Service account key.
2.4. Under Service account, choose Compute Engine default service account, and leave JSON selected under Key type. Next click Create. Your browser asks to download a JSON file. Save this file to a disk.
2.5. Set GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the saved JSON file.
Hold down the Windows Key and press R on your keyboard to open Run dialog box.
For a file named FILENAME.json in CURRENT_USER’s Downloads directory, located on the C drive, run the following command:
setx GOOGLE_APPLICATION_CREDENTIALS "C:\Users\CURRENT_USER\Downloads\FILENAME.json"
Please note: Instead of "C:\Users\CURRENT_USER\Downloads\FILENAME.json" should be path to the saved JSON file.
Also you can add GOOGLE_APPLICATION_CREDENTIALS environment variable via Control Panel:
- Open the Control Panel.
- Click System and Security, then System.
- Click Advanced system settings on the left.
- Inside the System Properties window, click the Environment Variables… button.