google-cloud-spanner-jdbc overview (2.9.16)

A JDBC driver for Cloud Spanner - A no-compromise relational database service.

Example for creating a JDBC connection to Cloud Spanner.

 String projectId = "my-project";
 String instanceId = "my-instance";
 String databaseId = "my-database";

 try (Connection connection =
             projectId, instanceId, databaseId))) {
   try (Statement statement = connection.createStatement()) {
     try (ResultSet rs = statement.executeQuery("SELECT CURRENT_TIMESTAMP()")) {
       while ( {
             "Connected to Cloud Spanner at [%s]%n", rs.getTimestamp(1).toString());

See Also: Cloud Spanner JDBC Driver, JdbcDriver java doc for all supported connection URL properties.