somu-imply commented on code in PR #14510: URL: https://github.com/apache/druid/pull/14510#discussion_r1286026504
########## docs/api-reference/sql-jdbc.md: ########## @@ -27,23 +27,44 @@ sidebar_label: SQL JDBC driver > This document describes the SQL language. -You can make [Druid SQL](../querying/sql.md) queries using the [Avatica JDBC driver](https://calcite.apache.org/avatica/downloads/). We recommend using Avatica JDBC driver version 1.17.0 or later. Note that as of the time of this writing, Avatica 1.17.0, the latest version, does not support passing connection string parameters from the URL to Druid, so you must pass them using a `Properties` object. Once you've downloaded the Avatica client jar, add it to your classpath and use the connect string `jdbc:avatica:remote:url=http://BROKER:8082/druid/v2/sql/avatica/`. +You can make [Druid SQL](./sql.md) queries using the [Avatica JDBC driver](https://calcite.apache.org/avatica/downloads/). +We recommend using Avatica JDBC driver version 1.22.0 or later. +Once you've downloaded the Avatica client jar, add it to your classpath. -When using the JDBC connector for the [examples](#examples) or in general, it's helpful to understand the parts of the connect string stored in the `url` variable: +Example connection string: - - `jdbc:avatica:remote:url=` is prepended to the hostname and port. - - The hostname and port number for your Druid deployment depends on whether you want to connect to the Router or a specific Broker. For more information, see [Connection stickiness](#connection-stickiness). In the case of the quickstart deployment, the hostname and port are `http://localhost:8888`, which connects to the Router running on your local machine. - - The SQL endpoint in Druid for the Avatica driver is `/druid/v2/sql/avatica/`. +``` +jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/;transparent_reconnect=true +``` + +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 +``` -Example code: +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). + +Set `transparent_reconnect` to `true` so your connection is not interrupted if the pool of Brokers changes membership, +or if a Broker is restarted. + +Set `serialization` to `protobuf` if using the protobuf endpoint. + +Note that as of the time of this writing, Avatica 1.22.0, the latest version, does not support passing Review Comment: Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
