1
votes

I'm running gcr.io/cloud-spanner-emulator/emulator in a Docker container on my dev machine. I would like to connect to the database from the Intellij Database Navigator so that I can see what data was written to my tables.

In Database Navigator, I have created a new Generic connection and configured it to make use of the google-cloud-spanner-jdbc driver (version 1.17.3, obtained from maven), using the connection string

jdbc:cloudspanner://localhost:9010/projects/my-project/instances/my-instance/databases/main;usePlainText=true

as documented here, but with the correct project, instance, and database name subbed in. Crucially, I have included the usePlainText=true parameter as documented in this question.

When I test the connection, I get an error message that says

Cannot connect to "Spanner Localstack". INVALID_ARGUMENT: Invalid properties found in connection URI: v$session.program, ApplicationName

Has anybody successfully connected Intellij's Database Navigator to the cloud-spanner-emulator using the google-cloud-spanner-jdbc driver?

1

1 Answers

1
votes

Your setup and JDBC URL all seem to be ok. The problem is caused by the following combination that is out of your control:

  1. Database Navigator automatically add this to the connection properties: https://bitbucket.org/dancioca/dbn/src/d67a09f92b4b9f27e0d1feb91dada9bf0fe802eb/src/com/dci/intellij/dbn/connection/Connector.java?at=master#lines-92
  2. The Cloud Spanner JDBC Driver checks that it only receives known properties: https://github.com/googleapis/java-spanner/blob/907ae1ff2f5c0b60510c435f5ba270bd92827104/google-cloud-spanner/src/main/java/com/google/cloud/spanner/connection/ConnectionOptions.java#L602

As the Cloud Spanner JDBC driver does not know all the properties that Database Navigator is adding, it will refuse the connection. I'll have a look and see if we can get that fixed in the JDBC driver.