0
votes

I've created a test cloud spanner instance and database have have been attempting to connect to it through DBVisualizer.

I have authenticated using the gcloud auth command, and have the driver set up within DBVisualizer.

The connection string I'm using is:

jdbc:cloudspanner://;Project=testapp;Instance=test-instance;Database=test-spanner;PvtKeyPath=/Users/userhome/.config/gcloud/application_default_credentials.json

However, when I try to connect I get the following error:

[Simba][SpannerJDBCDriver](100004) Failed to connect to Spanner: No NameResolverProviders found via ServiceLoader, including for DNS. This is probably due to a broken build. If using ProGuard, check your configuration

Is there anyway to get a connection from a DB Management Tool such as DB Visualizer?

3

3 Answers

1
votes

I found a solution on MacOS at least. Copy the CloudSpannerJDBC42.jar and google-cloud-spanner-0.9.4-beta.jar to DBvisualizers lib folder. In the case of MacOS the location is:

/Applications/DbVisualizer.app/Contents/java/app/lib

Restart DBVisualizer and then you can connect.

0
votes

I don't think DBVisualizer supports Cloud Spanner right now. See their documentation: https://www.dbvis.com/features/

As the product is still pretty new publicly, we'll hopefully be seeing more 3rd party support in the coming months.

0
votes

I've run into similar problems with the driver supplied by Google, so I decided to develop my own. The driver has both a 'thin' version and a 'fat' version. The thin version is intended as a dependency to be included in Java applications you develop yourself. The thick version can be used for standalone purposes, such as these kind of connections. The thick version (and other) can be found here: https://github.com/olavloite/spanner-jdbc/releases

More information about the whole driver can be found on my GitHub page.

The driver does work with DBVisualizer. Follow these steps to set it up:

  1. Download the driver and place it in your JRE/lib/ext directory (this is necessary because of dynamic loading of services done by the underlying Google Cloudspanner API). Make sure you place it in the lib/ext directory of the JRE you are actually using with DBVisualizer.
  2. Open DBVisualizer and open Driver Manager. Click on Create a new Driver.
  3. Give it the name Cloudspanner
  4. URL format is jdbc:cloudspanner://localhost;Project=projectId;Instance=instanceId;Database=databaseName;PvtKeyPath=key_file
  5. Driver class is automatically selected.
  6. Close the Driver Manager and make a new connection using the new driver.