Doc changes for avatica transparent reconnection (#14896)

This commit is contained in:
Soumyava 2023-08-22 11:58:17 -07:00 committed by GitHub
parent b9a33949fd
commit 6817de9376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -36,19 +36,19 @@ Once you've downloaded the Avatica client jar, add it to your classpath.
Example connection string: Example connection string:
``` ```
jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnect=true jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnection=true
``` ```
Or, to use the protobuf protocol instead of JSON: Or, to use the protobuf protocol instead of JSON:
``` ```
jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica-protobuf/;transparent_reconnect=true;serialization=protobuf jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica-protobuf/;transparent_reconnection=true;serialization=protobuf
``` ```
The `url` is the `/druid/v2/sql/avatica/` endpoint on the Router, which routes JDBC connections to a consistent Broker. The `url` is the `/druid/v2/sql/avatica/` endpoint on the Router, which routes JDBC connections to a consistent Broker.
For more information, see [Connection stickiness](#connection-stickiness). For more information, see [Connection stickiness](#connection-stickiness).
Set `transparent_reconnect` to `true` so your connection is not interrupted if the pool of Brokers changes membership, Set `transparent_reconnection` to `true` so your connection is not interrupted if the pool of Brokers changes membership,
or if a Broker is restarted. or if a Broker is restarted.
Set `serialization` to `protobuf` if using the protobuf endpoint. Set `serialization` to `protobuf` if using the protobuf endpoint.
@ -61,7 +61,7 @@ Example Java code:
```java ```java
// Connect to /druid/v2/sql/avatica/ on your Broker. // Connect to /druid/v2/sql/avatica/ on your Broker.
String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnect=true"; String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnection=true";
// Set any connection context parameters you need here. // Set any connection context parameters you need here.
// Any property from https://druid.apache.org/docs/latest/querying/sql-query-context.html can go here. // Any property from https://druid.apache.org/docs/latest/querying/sql-query-context.html can go here.
@ -85,7 +85,7 @@ For a runnable example that includes a query that you might run, see [Examples](
It is also possible to use a protocol buffers JDBC connection with Druid, this offer reduced bloat and potential performance It is also possible to use a protocol buffers JDBC connection with Druid, this offer reduced bloat and potential performance
improvements for larger result sets. To use it apply the following connection URL instead, everything else remains the same improvements for larger result sets. To use it apply the following connection URL instead, everything else remains the same
``` ```
String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica-protobuf/;transparent_reconnect=true;serialization=protobuf"; String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica-protobuf/;transparent_reconnection=true;serialization=protobuf";
``` ```
:::info :::info
@ -155,7 +155,7 @@ public class JdbcListColumns {
{ {
// Connect to /druid/v2/sql/avatica/ on your Router. // Connect to /druid/v2/sql/avatica/ on your Router.
// You can connect to a Broker but must configure connection stickiness if you do. // You can connect to a Broker but must configure connection stickiness if you do.
String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnect=true"; String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnection=true";
String query = "SELECT COLUMN_NAME,* FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'wikipedia' and TABLE_SCHEMA='druid'"; String query = "SELECT COLUMN_NAME,* FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'wikipedia' and TABLE_SCHEMA='druid'";
@ -195,7 +195,7 @@ public class JdbcCountryAndTime {
{ {
// Connect to /druid/v2/sql/avatica/ on your Router. // Connect to /druid/v2/sql/avatica/ on your Router.
// You can connect to a Broker but must configure connection stickiness if you do. // You can connect to a Broker but must configure connection stickiness if you do.
String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnect=true"; String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnection=true";
//The query you want to run. //The query you want to run.
String query = "SELECT __time, isRobot, countryName, comment FROM wikipedia WHERE countryName='Japan'"; String query = "SELECT __time, isRobot, countryName, comment FROM wikipedia WHERE countryName='Japan'";