Skip to content

feat: Auto-configure emulator when connecting with JDBC #380

@olavloite

Description

@olavloite

Connecting to the Cloud Spanner emulator with JDBC can be a little cumbersome, as

  1. The JDBC driver can only connect to existing instances and databases. A freshly started emulator does not contain any of those.
  2. The user needs to either specify the host and port number of the emulator, and set usePlainText to true, OR set the SPANNER_EMULATOR_HOST environment variable.

The first point makes it very difficult to execute tests against the emulator when using only JDBC, as the instance and database needs to be created by an external program/script before a JDBC connection can be created. It also makes it very difficult to connect to the emulator from generic tools like DBeaver.

Adding a connection option to the JDBC driver to automatically configure and connect to the emulator would make testing a lot easier. When the option is set, the JDBC driver would:

  1. Automatically connect to the default host:port combination of the emulator. This can be overridden by the user if they have chosen a custom host/port.
  2. Automatically turn off authentication and use plain text communication.
  3. Automatically create both the instance and the database that are mentioned in the connection string if any of these do not already exist. Any existing instance/database should be used if it already exists.

Metadata

Metadata

Assignees

Labels

api: spannerIssues related to the googleapis/java-spanner-jdbc API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions