Cloud Spanner is a horizontally-scalable database-as-a-service with transactions and SQL support. These sample Java applications demonstrate how to access the Spanner API using the Google Cloud Client Library for Java.
Install Maven.
Build your project from the root directory (java-spanner
):
mvn clean package -DskipTests
cd samples/snippets
mvn package
Every subsequent command here should be run from a subdirectory samples/snippets
.
Usage:
java -jar target/spanner-snippets/spanner-google-cloud-samples.jar operation my-instance my-database
Create Database:
java -jar target/spanner-google-cloud-samples-jar-with-dependencies.jar my-instance my-database
Listing database operations:
java -jar target/spanner-snippets/spanner-google-cloud-samples.jar listdatabaseoperations my-instance my-database