Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Adds README for running the samples (#509)
- Loading branch information
1 parent
5956677
commit 85086b4
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Getting Started with Cloud Spanner and the Google Cloud Client libraries | ||
|
||
<a href="https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/java-docs-samples&page=editor&open_in_editor=spanner/cloud-client/README.md"> | ||
<img alt="Open in Cloud Shell" src ="http://gstatic.com/cloudssh/images/open-btn.png"></a> | ||
|
||
[Cloud Spanner][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][java-spanner]. | ||
|
||
[Spanner]: https://cloud.google.com/spanner/ | ||
[java-spanner]: https://github.com/googleapis/java-spanner | ||
|
||
## Quickstart | ||
|
||
Every command here should be run from the root directory of your project (`java-spanner`). | ||
|
||
Install [Maven](http://maven.apache.org/). | ||
|
||
Build your project with: | ||
|
||
mvn clean package -DskipTests -DskipUTs -Penable-samples | ||
|
||
You can then run a given `ClassName` via: | ||
|
||
mvn exec:java -Dexec.mainClass=com.example.spanner.ClassName \ | ||
-DpropertyName=propertyValue \ | ||
-Dexec.args="any arguments to the app" | ||
|
||
### Running a simple query (using the quickstart sample) | ||
|
||
mvn exec:java -Dexec.mainClass=com.example.spanner.QuickstartSample -Dexec.args="my-instance my-database" | ||
|
||
## Tutorial | ||
|
||
### Running the tutorial | ||
mvn exec:java -Dexec.mainClass=com.example.spanner.SpannerSample -Dexec.args="<command> my-instance my-database" | ||
|
||
## Tracing sample | ||
`TracingSample.java` demonstrates how to export traces generated by client library to StackDriver and to /tracez page. | ||
|
||
### Running the tracing sample | ||
mvn exec:java -Dexec.mainClass=com.example.spanner.TracingSample -Dexec.args="my-instance my-database" | ||
|
||
## Test | ||
mvn verify -Dspanner.test.instance=<instance id> -Dspanner.sample.database=<new database id> -Dspanner.quickstart.database=<existing database id> |