Search code examples
google-cloud-platformgoogle-cloud-spanner

How to use Service Account key with Simba JDBC Driver for Google Spanner


Is there a way to explicitly configure a service account key for Simba JDBC Driver for Google Cloud Spanner and avoid using GOOGLE_APPLICATION_CREDENTIALS?


Solution

  • The latest release of the driver (1.0.4.1005) appears to support an optional JDBC parameter PvtKeyPath which takes a path to your private key as opposed to having to set the GOOGLE_APPLICATION_CREDENTIALS variable. Worth a look.

    From the included PDF documentation:

    PvtKeyPath

    So you will have a URL like: jdbc:cloudspanner://;Project=...;PvtKeyPath=/path/to/credentials.json