提交 c2509757 编写于 作者: D dingbo

docs: refine python and java connect tutorial

上级 acf996cd
...@@ -31,6 +31,8 @@ You should replace above placeholders as real values. To obtain these values, pl ...@@ -31,6 +31,8 @@ You should replace above placeholders as real values. To obtain these values, pl
## Connect ## Connect
Copy code bellow to your editor and run it with `python3` command.
```python ```python
import taosrest import taosrest
import os import os
...@@ -41,4 +43,4 @@ token = os.environ["TDENGINE_CLOUD_TOKEN"] ...@@ -41,4 +43,4 @@ token = os.environ["TDENGINE_CLOUD_TOKEN"]
conn = taosrest.connect(url=url, token=token) conn = taosrest.connect(url=url, token=token)
``` ```
The client connection is then established. For how to write data and query data, please refer to [basic usage](../../connector/python#basic-usage). The client connection is then established. For how to write data and query data, please refer to [sample-program](https://docs.tdengine.com/cloud/connector/python/#sample-program).
...@@ -42,6 +42,8 @@ You should replace above placeholders as real values. To obtain these values, pl ...@@ -42,6 +42,8 @@ You should replace above placeholders as real values. To obtain these values, pl
## Connect ## Connect
Code bellow get variable URL and token from environment first and then create a `RestfulConnection` object, witch is a standard JDBC Connection object.
```java ```java
import com.taosdata.jdbc.rs.RestfulConnection; import com.taosdata.jdbc.rs.RestfulConnection;
import java.sql.Connection; import java.sql.Connection;
...@@ -51,10 +53,9 @@ public class ConnectCloudExample { ...@@ -51,10 +53,9 @@ public class ConnectCloudExample {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String url = System.getenv("TDENGINE_CLOUD_URL"); String url = System.getenv("TDENGINE_CLOUD_URL");
String token = System.getenv("TDENGINE_CLOUD_TOKEN"); String token = System.getenv("TDENGINE_CLOUD_TOKEN");
// create a standard JDBC connection.
Connection conn = new RestfulConnection(url, token); Connection conn = new RestfulConnection(url, token);
} }
} }
``` ```
The client connection is then established. The client connection is then established. For how to write data and query data using the connection, please refer to [usage-examples](https://docs.tdengine.com/reference/connector/java#usage-examples).
\ No newline at end of file \ No newline at end of file
...@@ -71,7 +71,7 @@ For a more detailed description of the `sql()` method, please refer to [RestClie ...@@ -71,7 +71,7 @@ For a more detailed description of the `sql()` method, please refer to [RestClie
| ----------------- | ----------------------------------------- | ------------ | | ----------------- | ----------------------------------------- | ------------ |
| 2.3.3 | support connect to TDengine Cloud Service | 2022-06-06 | | 2.3.3 | support connect to TDengine Cloud Service | 2022-06-06 |
[**Release Notes**] (https://github.com/taosdata/taos-connector-python/releases) [**Release Notes**](https://github.com/taosdata/taos-connector-python/releases)
## API Reference ## API Reference
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册