Jose Gutierrez
Jose Gutierrez

Reputation: 137

JDBC connection to Google Cloud Spanner parameters

I have a Google Cloud Spanner instance and database.

I am trying to connect to it: enter image description here

But I don't know what to fill the "Custom JDBC URL" , "User id" or "User Password" with as this parameters are not given in the website or configured when creating the instance.

EDIT:

I have added some information leading to the following parameters: enter image description here

My full path is now:

jdbc:cloudspanner:/projects/bupry-332316/instances/genupry-sql-test/databases/genupry-db-1?credentials=D:\Genexus\Models\Wultu\bupry-332316-f760bf33afc1.json;autocommit=false;lenient=true

However I am still getting an error, which is the following enter image description here

Upvotes: 0

Views: 1500

Answers (1)

Knut Olav Løite
Knut Olav Løite

Reputation: 3512

As @Catherine O mentioned in a comment: Please include what tool you are using to try to connect to Cloud Spanner.

Based on the screenshot you included, I think there are a couple of things that you need to change:

  1. You now have the JDBC URL in the field Custom JDBC Driver. The Custom JDBC driver field should be filled with the name or reference to the .jar file of the JDBC driver (exactly what this tool expects is impossible to know without knowing what tool it is).
  2. The string that you entered into the Custom JDBC driver field is what should be entered in Custom JDBC URL.
  3. User ID and Password should be left empty.

Cloud Spanner does not use a User ID and Password for authentication. Instead it uses Google Cloud credentials. Add these to the JDBC URL by adding something like ;credentials=/path/to/credentials.json to the JDBC URL (the path must point to a valid credentials file). See also https://googleapis.dev/java/google-cloud-spanner-jdbc/latest/com/google/cloud/spanner/jdbc/JdbcDriver.html for a full example.

EDIT: Client information and new Stacktrace shared

The stacktrace that you are now getting seems to indicate that the driver is being picked up and a connection is being made, but that there is some internal error in the JDBC driver:

Upvotes: 2

Related Questions