From 7529438c23f3b9d3fb4be770b5e6716c1a55a5a0 Mon Sep 17 00:00:00 2001 From: dingbo Date: Tue, 7 Jun 2022 07:49:02 +0800 Subject: [PATCH] docs: update java demo code --- docs-en/05-develop/01-connect/01-python.md | 8 ++++---- docs-en/05-develop/01-connect/02-java.md | 15 +++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/docs-en/05-develop/01-connect/01-python.md b/docs-en/05-develop/01-connect/01-python.md index f861f3365a..434456ddb0 100644 --- a/docs-en/05-develop/01-connect/01-python.md +++ b/docs-en/05-develop/01-connect/01-python.md @@ -13,12 +13,12 @@ pip3 install taospy>=2.3.3 You'll need to have Python3 installed. -## Config +## Config {#config} -Run this command in your terminal to save your url and token as variables: +Run this command in your terminal to save your URL and token as variables: ```bash -export TDENGINE_CLOUD_URL= +export TDENGINE_CLOUD_URL= export TDENGINE_CLOUD_TOKEN= ``` @@ -29,7 +29,7 @@ You should replace above placeholders as real values. To obtain these values, pl ::: -## Connect +## Connect {#connect} ```python import taosrest diff --git a/docs-en/05-develop/01-connect/02-java.md b/docs-en/05-develop/01-connect/02-java.md index 7945df3c2b..433495d12b 100644 --- a/docs-en/05-develop/01-connect/02-java.md +++ b/docs-en/05-develop/01-connect/02-java.md @@ -23,7 +23,7 @@ dependencies { } ``` -## Config +## Config {#config} Run this command in your terminal to save your url and token as variables: @@ -40,22 +40,21 @@ You should replace above placeholders as real values. To obtain these values, pl ::: -## Connect +## Connect {#connect} ```java -import com.taosdata.jdbc.TSDBDriver; - +import com.taosdata.jdbc.rs.RestfulConnection; import java.sql.Connection; -import java.sql.SQLException; public class ConnectCloudExample { - public static void main(String[] args) throws SQLException { + public static void main(String[] args) throws Exception { String url = System.getenv("TDENGINE_CLOUD_URL"); String token = System.getenv("TDENGINE_CLOUD_TOKEN"); - Connection conn = TSDBDriver.connect(url, token); // demo code for discussion. + // create a standard JDBC connection. + Connection conn = new RestfulConnection(url, token); } } ``` -The client connection is then established. \ No newline at end of file +The client connection is then established. \ No newline at end of file -- GitLab