Skip to content

CloudSpanner JDBC: Project IDs that contain period and colon fail URL matching when creating connections #33

@jeffersonatsafe

Description

@jeffersonatsafe

Environment details

  1. API: CloudSpanner JDBC
  2. OS type and version: Windows 10
  3. Java version: 8
  4. spanner-jdbc version(s): 1.12.0

Steps to reproduce

  1. have a google cloud platform project ID that has a period and a colon (we created this project before Google restricted project IDs to having only letters, numbers, and hyphens). I suppose this is a grandfathered project ID.
  2. try to use the project ID in creating the connection string. ours look like this:
    jdbc:cloudspanner:/projects/safe.com:fme-big-query-api/instances/myinstance/databases/mydb

result:
error

com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory$JdbcSqlExceptionImpl: INVALID_ARGUMENT: invalid url: jdbc:cloudspanner:/projects/safe.com:fme-big-query-api/instances/myinstance/databases/mydb

Code example

      String driverClassName = JdbcDriver.class.getCanonicalName();
      Class<?> driverClass = Class.forName(driverClassName);
      Driver driver = (Driver)driverClass.newInstance();
      Connection connection = driver.connect(connString, connProps);

Stack trace

com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory$JdbcSqlExceptionImpl: INVALID_ARGUMENT: invalid url: jdbc:cloudspanner:/projects/safe.com:fme-big-query-api/instances/myinstance/databases/mydb

	at com.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory.of(JdbcSqlExceptionFactory.java:234)
	at com.google.cloud.spanner.jdbc.JdbcDriver.connect(JdbcDriver.java:174)

Thanks!

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: spannerIssues related to the googleapis/java-spanner-jdbc API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions