|
| 1 | +/* |
| 2 | + * Copyright 2020 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +/** |
| 18 | + * A JDBC driver for Cloud Spanner - A no-compromise relational database service. |
| 19 | + * |
| 20 | + * <p>Example for creating a JDBC connection to Cloud Spanner. |
| 21 | + * |
| 22 | + * <pre>{@code |
| 23 | + * String projectId = "my-project"; |
| 24 | + * String instanceId = "my-instance"; |
| 25 | + * String databaseId = "my-database"; |
| 26 | + * |
| 27 | + * try (Connection connection = |
| 28 | + * DriverManager.getConnection( |
| 29 | + * String.format( |
| 30 | + * "jdbc:cloudspanner:/projects/%s/instances/%s/databases/%s", |
| 31 | + * projectId, instanceId, databaseId))) { |
| 32 | + * try (Statement statement = connection.createStatement()) { |
| 33 | + * try (ResultSet rs = statement.executeQuery("SELECT CURRENT_TIMESTAMP()")) { |
| 34 | + * while (rs.next()) { |
| 35 | + * System.out.printf( |
| 36 | + * "Connected to Cloud Spanner at [%s]%n", rs.getTimestamp(1).toString()); |
| 37 | + * } |
| 38 | + * } |
| 39 | + * } |
| 40 | + * } |
| 41 | + * }</pre> |
| 42 | + * |
| 43 | + * @see <a |
| 44 | + * href="https://googleapis.dev/java/google-cloud-spanner-jdbc/latest/com/google/cloud/spanner/jdbc/JdbcDriver.html">JdbcDriver |
| 45 | + * java doc</a> for all supported connection URL properties. |
| 46 | + * @see <a href="https://cloud.google.com/spanner/docs/use-oss-jdbc">Cloud Spanner JDBC Driver</a> |
| 47 | + */ |
| 48 | +package com.google.cloud.spanner.jdbc; |
0 commit comments