Cloud Spanner connectivity using JetBrains IDEsCloud Spanner connectivity using JetBrains IDEsDeveloper Relations EngineerStaff Interaction Designer

If you are a developer working on an application backed by Google Cloud Spanner and use an IDE from  the JetBrains suite of developer tools, we’ve got some good news for you! You can now browse the database schema and query data stored in Cloud Spanner directly from your JetBrains IDE. In this post, I will show you how to connect to a Cloud Spanner instance using IntelliJ IDEA.


To connect to Cloud Spanner within IntelliJ, you will need:

Adding the Cloud Spanner data source

To add Cloud Spanner as a data source, open the Database tool window by navigating to View -> Tool Windows -> Database within your IntelliJ project. This will open a sidebar in IntelliJ that will show you a list of your current database connections for the project. If you have never added a connection, this sidebar will be empty. Click the ‘+’ icon to bring up the list of data sources you can add. The Cloud Spanner data source can be found under the ‘Other’ section of this list. This is because the data source is published under Basic Support. 

According to IntelliJ documentation, Basic Support provides, “code highlighting and displays objects that were retrieved by the JDBC driver. IntelliJ IDEA uses JDBC metadata for database introspection and the SQL 2016 dialect for code highlighting. No errors are detected and highlighted. The introspection with JDBC metadata means that some specific database objects will not appear in the database tree view. Code completion will not include objects that were not retrieved during introspection.”

Leave a Comment