Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jeffersonatsafe opened this issue Jan 14, 2020 · 0 comments · Fixed by #36
Assignees
Labels
api: spanner Issues related to the googleapis/java-spanner-jdbc API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@jeffersonatsafe
Copy link

jeffersonatsafe commented Jan 14, 2020

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!

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jan 15, 2020
@olavloite olavloite added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Jan 20, 2020
@olavloite olavloite self-assigned this Jan 20, 2020
olavloite added a commit that referenced this issue Jan 20, 2020
The project ID part of a connection URL should allow the use of dots
and colons.

Fixes #33
olavloite added a commit that referenced this issue Jan 22, 2020
* fix: allow dots and colons in project id

The project ID part of a connection URL should allow the use of dots
and colons.

Fixes #33

* fix: escaping dot in square brackets is not needed
@google-cloud-label-sync google-cloud-label-sync bot added the api: spanner Issues related to the googleapis/java-spanner-jdbc API. label Jan 31, 2020
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner-jdbc API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants