[Docs] Add example connection parameters for Java APIs (#15345)

This commit is contained in:
Petrichor 2023-11-28 17:39:41 +08:00 committed by GitHub
parent 7a8204db72
commit b102667695
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,10 @@ String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica
// Any property from https://druid.apache.org/docs/latest/querying/sql-query-context.html can go here.
Properties connectionProperties = new Properties();
connectionProperties.setProperty("sqlTimeZone", "Etc/UTC");
//To connect to a Druid deployment protected by basic authentication,
//you can incorporate authentication details from https://druid.apache.org/docs/latest/operations/security-overview
connectionProperties.setProperty("user", "admin");
connectionProperties.setProperty("password", "password1");
try (Connection connection = DriverManager.getConnection(url, connectionProperties)) {
try (