Package com.google.cloud.spanner.jdbc
package com.google.cloud.spanner.jdbc
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 =
DriverManager.getConnection(
String.format(
"jdbc:cloudspanner:/projects/%s/instances/%s/databases/%s",
projectId, instanceId, databaseId))) {
try (Statement statement = connection.createStatement()) {
try (ResultSet rs = statement.executeQuery("SELECT CURRENT_TIMESTAMP()")) {
while (rs.next()) {
System.out.printf(
"Connected to Cloud Spanner at [%s]%n", rs.getTimestamp(1).toString());
}
}
}
}
- See Also:
-
- JdbcDriver java doc for all supported connection URL properties.
- Cloud Spanner JDBC Driver
-
ClassDescriptionJDBC connection with a number of additional Cloud Spanner specific methods.Result set that is returned for partitioned queries, e.g. for 'run partitioned query select ...'This interface is implemented by
PreparedStatements that are created on Cloud Spanner JDBC connections.This interface is implemented byStatements that are created on Cloud Spanner JDBC connections.Constants for special values used by the Cloud Spanner JDBC driver.DataSourceimplementation for Google Cloud Spanner.JDBCDriverfor Google Cloud Spanner.Base interface for all Cloud SpannerSQLExceptions.Factory class for creatingSQLExceptions for Cloud SpannerSpecificSQLExceptionthat is thrown when a transaction was aborted and could not be retried due to a concurrent modification.SpecificSQLExceptionthat is thrown when a transaction was aborted and could not be successfully retried.SpecificSQLExceptionthat is thrown when aSpannerBatchUpdateExceptionoccurs.SpecificSQLExceptionthat is thrown when setting client info on a connectionBaseSQLExceptionfor Cloud SpannerSpecificSQLExceptionthat is thrown for unsupported methods and valuesSpecificSQLExceptionthat is thrown when a statement times outCustom SQL type for Spanner JSON data type.Custom SQL type for Spanner PROTO data type.Custom SQL type for Spanner PROTO data type.Deprecated.Deprecated.Deprecated.