From 08bc5e3f54051b484f2aceca0fbb57b635e2012b Mon Sep 17 00:00:00 2001 From: Dennis Zhuang Date: Tue, 28 May 2024 15:42:59 -0700 Subject: [PATCH 1/4] feat: adds time zone setting for JDBC --- docs/nightly/en/greptimecloud/integrations/mysql.md | 2 ++ docs/nightly/en/user-guide/client-libraries/java.md | 11 +++++++++++ docs/nightly/zh/greptimecloud/integrations/mysql.md | 2 ++ docs/nightly/zh/user-guide/client-libraries/java.md | 10 ++++++++++ docs/v0.8/en/greptimecloud/integrations/mysql.md | 2 ++ docs/v0.8/en/user-guide/client-libraries/java.md | 11 +++++++++++ docs/v0.8/zh/greptimecloud/integrations/mysql.md | 2 ++ docs/v0.8/zh/user-guide/client-libraries/java.md | 10 ++++++++++ 8 files changed, 50 insertions(+) diff --git a/docs/nightly/en/greptimecloud/integrations/mysql.md b/docs/nightly/en/greptimecloud/integrations/mysql.md index 5308cd3b2..5fdc3f3f5 100644 --- a/docs/nightly/en/greptimecloud/integrations/mysql.md +++ b/docs/nightly/en/greptimecloud/integrations/mysql.md @@ -36,6 +36,8 @@ Use following connect string for your JDBC client. jdbc:mysql://:4002/?user=&password= ``` +Read the [time zone setting](/user-guide/client-libraries/java#time-zone) for JDBC. + And if you are using client like Python, use following url to connect to your instance. diff --git a/docs/nightly/en/user-guide/client-libraries/java.md b/docs/nightly/en/user-guide/client-libraries/java.md index 644a1a63e..ef8be3aa8 100644 --- a/docs/nightly/en/user-guide/client-libraries/java.md +++ b/docs/nightly/en/user-guide/client-libraries/java.md @@ -444,6 +444,17 @@ db.password= Or you can just get the file from [here](https://github.com/GreptimeTeam/greptimedb-ingester-java/blob/main/ingester-example/src/main/resources/db-connection.properties). +#### Time zone + +Set the JDBC time zone by setting URL parameters: + +```txt +jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true +``` + +* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` specifies how the server's session time zone (about which the timestamps are saved onto the server) is to be determined by Connector/J. Read the [MySQL manual](https://dev.mysql.com/doc/connector-j/en/connector-j-time-instants.html) for more details. +* `forceConnectionTimeZoneToSession=true` makes the session `time_zone` variable to be set to the value specified in `connectionTimeZone`. + %} {template query-library-raw-sql% diff --git a/docs/nightly/zh/greptimecloud/integrations/mysql.md b/docs/nightly/zh/greptimecloud/integrations/mysql.md index 799d36e5d..8c344acfa 100644 --- a/docs/nightly/zh/greptimecloud/integrations/mysql.md +++ b/docs/nightly/zh/greptimecloud/integrations/mysql.md @@ -34,6 +34,8 @@ mysql --ssl -u -p -h -P 4002 -A jdbc:mysql://:4002/?user=&password= ``` + JDBC 的时区设置请阅读[这篇文档](/user-guide/client-libraries/java#时区)。 + 如果你使用 Python 等语言的客户端,也可以复制以下 URL 进行连接 ``` diff --git a/docs/nightly/zh/user-guide/client-libraries/java.md b/docs/nightly/zh/user-guide/client-libraries/java.md index a52837b4b..bf5951742 100644 --- a/docs/nightly/zh/user-guide/client-libraries/java.md +++ b/docs/nightly/zh/user-guide/client-libraries/java.md @@ -437,6 +437,16 @@ db.password= 或者你可以从[这里](https://github.com/GreptimeTeam/greptimedb-ingester-java/blob/main/ingester-example/src/main/resources/db-connection.properties)获取文件。 +#### 时区 + +通过设置URL参数来设置JDBC时区: + +```txt +jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true +``` + +* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` 指定Connector/J如何确定服务器 session 时区(时间戳保存到服务器的参考时区)。详情请参阅[MySQL手册](https://dev.mysql.com/doc/connector-j/en/connector-j-time-instants.html)。 +* `forceConnectionTimeZoneToSession=true` 使 session `time_zone` 变量被设置为 `connectionTimeZone` 指定的值。 %} {template query-library-raw-sql% diff --git a/docs/v0.8/en/greptimecloud/integrations/mysql.md b/docs/v0.8/en/greptimecloud/integrations/mysql.md index 5308cd3b2..5fdc3f3f5 100644 --- a/docs/v0.8/en/greptimecloud/integrations/mysql.md +++ b/docs/v0.8/en/greptimecloud/integrations/mysql.md @@ -36,6 +36,8 @@ Use following connect string for your JDBC client. jdbc:mysql://:4002/?user=&password= ``` +Read the [time zone setting](/user-guide/client-libraries/java#time-zone) for JDBC. + And if you are using client like Python, use following url to connect to your instance. diff --git a/docs/v0.8/en/user-guide/client-libraries/java.md b/docs/v0.8/en/user-guide/client-libraries/java.md index 644a1a63e..ef8be3aa8 100644 --- a/docs/v0.8/en/user-guide/client-libraries/java.md +++ b/docs/v0.8/en/user-guide/client-libraries/java.md @@ -444,6 +444,17 @@ db.password= Or you can just get the file from [here](https://github.com/GreptimeTeam/greptimedb-ingester-java/blob/main/ingester-example/src/main/resources/db-connection.properties). +#### Time zone + +Set the JDBC time zone by setting URL parameters: + +```txt +jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true +``` + +* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` specifies how the server's session time zone (about which the timestamps are saved onto the server) is to be determined by Connector/J. Read the [MySQL manual](https://dev.mysql.com/doc/connector-j/en/connector-j-time-instants.html) for more details. +* `forceConnectionTimeZoneToSession=true` makes the session `time_zone` variable to be set to the value specified in `connectionTimeZone`. + %} {template query-library-raw-sql% diff --git a/docs/v0.8/zh/greptimecloud/integrations/mysql.md b/docs/v0.8/zh/greptimecloud/integrations/mysql.md index 799d36e5d..8c344acfa 100644 --- a/docs/v0.8/zh/greptimecloud/integrations/mysql.md +++ b/docs/v0.8/zh/greptimecloud/integrations/mysql.md @@ -34,6 +34,8 @@ mysql --ssl -u -p -h -P 4002 -A jdbc:mysql://:4002/?user=&password= ``` + JDBC 的时区设置请阅读[这篇文档](/user-guide/client-libraries/java#时区)。 + 如果你使用 Python 等语言的客户端,也可以复制以下 URL 进行连接 ``` diff --git a/docs/v0.8/zh/user-guide/client-libraries/java.md b/docs/v0.8/zh/user-guide/client-libraries/java.md index a52837b4b..bf5951742 100644 --- a/docs/v0.8/zh/user-guide/client-libraries/java.md +++ b/docs/v0.8/zh/user-guide/client-libraries/java.md @@ -437,6 +437,16 @@ db.password= 或者你可以从[这里](https://github.com/GreptimeTeam/greptimedb-ingester-java/blob/main/ingester-example/src/main/resources/db-connection.properties)获取文件。 +#### 时区 + +通过设置URL参数来设置JDBC时区: + +```txt +jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true +``` + +* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` 指定Connector/J如何确定服务器 session 时区(时间戳保存到服务器的参考时区)。详情请参阅[MySQL手册](https://dev.mysql.com/doc/connector-j/en/connector-j-time-instants.html)。 +* `forceConnectionTimeZoneToSession=true` 使 session `time_zone` 变量被设置为 `connectionTimeZone` 指定的值。 %} {template query-library-raw-sql% From 5bf44df543ed2bec616f9e71e14433e5f84078bf Mon Sep 17 00:00:00 2001 From: Dennis Zhuang Date: Tue, 28 May 2024 15:46:53 -0700 Subject: [PATCH 2/4] chore: add spaces between en and ch --- docs/nightly/zh/user-guide/client-libraries/java.md | 2 +- docs/v0.8/zh/user-guide/client-libraries/java.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/nightly/zh/user-guide/client-libraries/java.md b/docs/nightly/zh/user-guide/client-libraries/java.md index bf5951742..52e52418d 100644 --- a/docs/nightly/zh/user-guide/client-libraries/java.md +++ b/docs/nightly/zh/user-guide/client-libraries/java.md @@ -439,7 +439,7 @@ db.password= #### 时区 -通过设置URL参数来设置JDBC时区: +通过设置 URL 参数来设置 JDBC 时区: ```txt jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true diff --git a/docs/v0.8/zh/user-guide/client-libraries/java.md b/docs/v0.8/zh/user-guide/client-libraries/java.md index bf5951742..f90e6cb51 100644 --- a/docs/v0.8/zh/user-guide/client-libraries/java.md +++ b/docs/v0.8/zh/user-guide/client-libraries/java.md @@ -439,7 +439,7 @@ db.password= #### 时区 -通过设置URL参数来设置JDBC时区: +通过设置 URL 参数来设置 JDBC 时区: ```txt jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true From 22ce765bd94e3adeed0a356c348d5a957f78638b Mon Sep 17 00:00:00 2001 From: Dennis Zhuang Date: Tue, 28 May 2024 15:58:16 -0700 Subject: [PATCH 3/4] chore: change desc --- docs/nightly/en/user-guide/client-libraries/java.md | 2 +- docs/nightly/zh/user-guide/client-libraries/java.md | 4 ++-- docs/v0.8/en/user-guide/client-libraries/java.md | 2 +- docs/v0.8/zh/user-guide/client-libraries/java.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/nightly/en/user-guide/client-libraries/java.md b/docs/nightly/en/user-guide/client-libraries/java.md index ef8be3aa8..bec0fbd40 100644 --- a/docs/nightly/en/user-guide/client-libraries/java.md +++ b/docs/nightly/en/user-guide/client-libraries/java.md @@ -452,7 +452,7 @@ Set the JDBC time zone by setting URL parameters: jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true ``` -* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` specifies how the server's session time zone (about which the timestamps are saved onto the server) is to be determined by Connector/J. Read the [MySQL manual](https://dev.mysql.com/doc/connector-j/en/connector-j-time-instants.html) for more details. +* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` specifies the connection time zone. * `forceConnectionTimeZoneToSession=true` makes the session `time_zone` variable to be set to the value specified in `connectionTimeZone`. %} diff --git a/docs/nightly/zh/user-guide/client-libraries/java.md b/docs/nightly/zh/user-guide/client-libraries/java.md index 52e52418d..7c0f04c81 100644 --- a/docs/nightly/zh/user-guide/client-libraries/java.md +++ b/docs/nightly/zh/user-guide/client-libraries/java.md @@ -439,13 +439,13 @@ db.password= #### 时区 -通过设置 URL 参数来设置 JDBC 时区: +通过设置 URL 参数来设置 JDBC 时区: ```txt jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true ``` -* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` 指定Connector/J如何确定服务器 session 时区(时间戳保存到服务器的参考时区)。详情请参阅[MySQL手册](https://dev.mysql.com/doc/connector-j/en/connector-j-time-instants.html)。 +* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` 配置连接时区。 * `forceConnectionTimeZoneToSession=true` 使 session `time_zone` 变量被设置为 `connectionTimeZone` 指定的值。 %} diff --git a/docs/v0.8/en/user-guide/client-libraries/java.md b/docs/v0.8/en/user-guide/client-libraries/java.md index ef8be3aa8..bec0fbd40 100644 --- a/docs/v0.8/en/user-guide/client-libraries/java.md +++ b/docs/v0.8/en/user-guide/client-libraries/java.md @@ -452,7 +452,7 @@ Set the JDBC time zone by setting URL parameters: jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true ``` -* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` specifies how the server's session time zone (about which the timestamps are saved onto the server) is to be determined by Connector/J. Read the [MySQL manual](https://dev.mysql.com/doc/connector-j/en/connector-j-time-instants.html) for more details. +* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` specifies the connection time zone. * `forceConnectionTimeZoneToSession=true` makes the session `time_zone` variable to be set to the value specified in `connectionTimeZone`. %} diff --git a/docs/v0.8/zh/user-guide/client-libraries/java.md b/docs/v0.8/zh/user-guide/client-libraries/java.md index f90e6cb51..7c0f04c81 100644 --- a/docs/v0.8/zh/user-guide/client-libraries/java.md +++ b/docs/v0.8/zh/user-guide/client-libraries/java.md @@ -445,7 +445,7 @@ db.password= jdbc:mysql://127.0.0.1:4002?connectionTimeZone=Asia/Shanghai&forceConnectionTimeZoneToSession=true ``` -* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` 指定Connector/J如何确定服务器 session 时区(时间戳保存到服务器的参考时区)。详情请参阅[MySQL手册](https://dev.mysql.com/doc/connector-j/en/connector-j-time-instants.html)。 +* `connectionTimeZone={LOCAL|SERVER|user-defined-time-zone}` 配置连接时区。 * `forceConnectionTimeZoneToSession=true` 使 session `time_zone` 变量被设置为 `connectionTimeZone` 指定的值。 %} From a4ba478c2821b4af1e0755b0b4cf5df771bce7ea Mon Sep 17 00:00:00 2001 From: Yiran Date: Wed, 29 May 2024 10:14:55 +0800 Subject: [PATCH 4/4] Apply suggestions from code review --- docs/nightly/en/greptimecloud/integrations/mysql.md | 2 +- docs/nightly/zh/greptimecloud/integrations/mysql.md | 2 +- docs/v0.8/en/greptimecloud/integrations/mysql.md | 2 +- docs/v0.8/zh/greptimecloud/integrations/mysql.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/nightly/en/greptimecloud/integrations/mysql.md b/docs/nightly/en/greptimecloud/integrations/mysql.md index 5fdc3f3f5..3f9b0654f 100644 --- a/docs/nightly/en/greptimecloud/integrations/mysql.md +++ b/docs/nightly/en/greptimecloud/integrations/mysql.md @@ -36,7 +36,7 @@ Use following connect string for your JDBC client. jdbc:mysql://:4002/?user=&password= ``` -Read the [time zone setting](/user-guide/client-libraries/java#time-zone) for JDBC. +Read the [time zone setting](https://docs.greptime.com/user-guide/client-libraries/java#time-zone) for JDBC. And if you are using client like Python, use following url to connect to your instance. diff --git a/docs/nightly/zh/greptimecloud/integrations/mysql.md b/docs/nightly/zh/greptimecloud/integrations/mysql.md index 8c344acfa..211940df0 100644 --- a/docs/nightly/zh/greptimecloud/integrations/mysql.md +++ b/docs/nightly/zh/greptimecloud/integrations/mysql.md @@ -34,7 +34,7 @@ mysql --ssl -u -p -h -P 4002 -A jdbc:mysql://:4002/?user=&password= ``` - JDBC 的时区设置请阅读[这篇文档](/user-guide/client-libraries/java#时区)。 + JDBC 的时区设置请阅读[这篇文档](https://docs.greptime.cn/user-guide/client-libraries/java#时区)。 如果你使用 Python 等语言的客户端,也可以复制以下 URL 进行连接 diff --git a/docs/v0.8/en/greptimecloud/integrations/mysql.md b/docs/v0.8/en/greptimecloud/integrations/mysql.md index 5fdc3f3f5..3f9b0654f 100644 --- a/docs/v0.8/en/greptimecloud/integrations/mysql.md +++ b/docs/v0.8/en/greptimecloud/integrations/mysql.md @@ -36,7 +36,7 @@ Use following connect string for your JDBC client. jdbc:mysql://:4002/?user=&password= ``` -Read the [time zone setting](/user-guide/client-libraries/java#time-zone) for JDBC. +Read the [time zone setting](https://docs.greptime.com/user-guide/client-libraries/java#time-zone) for JDBC. And if you are using client like Python, use following url to connect to your instance. diff --git a/docs/v0.8/zh/greptimecloud/integrations/mysql.md b/docs/v0.8/zh/greptimecloud/integrations/mysql.md index 8c344acfa..211940df0 100644 --- a/docs/v0.8/zh/greptimecloud/integrations/mysql.md +++ b/docs/v0.8/zh/greptimecloud/integrations/mysql.md @@ -34,7 +34,7 @@ mysql --ssl -u -p -h -P 4002 -A jdbc:mysql://:4002/?user=&password= ``` - JDBC 的时区设置请阅读[这篇文档](/user-guide/client-libraries/java#时区)。 + JDBC 的时区设置请阅读[这篇文档](https://docs.greptime.cn/user-guide/client-libraries/java#时区)。 如果你使用 Python 等语言的客户端,也可以复制以下 URL 进行连接