提交 7529438c 编写于 作者: D dingbo

docs: update java demo code

上级 17e29394
......@@ -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=<url>
export TDENGINE_CLOUD_URL=<URL>
export TDENGINE_CLOUD_TOKEN=<token>
```
......@@ -29,7 +29,7 @@ You should replace above placeholders as real values. To obtain these values, pl
:::
<!-- exclude-end -->
## Connect
## Connect {#connect}
```python
import taosrest
......
......@@ -23,7 +23,7 @@ dependencies {
}
```
## Config
## Config {#config}
Run this command in your terminal to save your url and token as variables:
......@@ -40,20 +40,19 @@ You should replace above placeholders as real values. To obtain these values, pl
:::
<!-- exclude-end -->
## 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);
}
}
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册