提交 fd357cce 编写于 作者: sangshuduo's avatar sangshuduo

docs: add rlang in connect section

上级 6453846a
---
toc_max_heading_level: 4
sidebar_label: R
title: TDengine R Language Connector
---
## Configuration
After completing the installation of the R programming environment, you need to perform some configuration steps so that the RJDBC library can connect to and access the TDengine time series database correctly.
1. Load the RJDBC library and other necessary libraries in your R script:
```r
library(DBI)
library(rJava)
library(RJDBC)
```
2. Set the JDBC driver path and JDBC URL:
```r
# Set the JDBC driver path (modify it based on where you actually saved it)
driverPath <- "/path/to/taos-jdbcdriver-X.X.X-dist.jar"
# Set the JDBC URL (modify it according to your specific environment)
url <- "<jdbcURL>"
```
3. Load the JDBC driver:
```r
# Load the JDBC driver
drv <- JDBC("com.taosdata.jdbc.TSDBDriver", driverPath)
```
4. Create a connection to the TDengine database:
```r
# Create a database connection
conn <- dbConnect(drv, url)
```
5. Once the connection is successful, you can use the conn object to perform various database operations such as querying data, inserting data, etc.
---
toc_max_heading_level: 4
sidebar_label: R
title: TDengine R Language Connector
---
## 配置
完成了 R 语言环境安装步骤后,您需要进行一些配置,以便RJDBC库能够正确连接和访问 TDengine 时序数据库。
1. 在 R 脚本中加载 RJDBC 和其他必要的库:
```r
library(DBI)
library(rJava)
library(RJDBC)
```
2. 设置 JDBC 驱动程序和 JDBC URL:
```r
# 设置JDBC驱动程序路径(根据您实际保存的位置进行修改)
driverPath <- "/path/to/taos-jdbcdriver-X.X.X-dist.jar"
# 设置JDBC URL(根据您的具体环境进行修改)
url <- "<jdbcURL>"
```
3. 加载 JDBC 驱动程序:
```r
# 加载JDBC驱动程序
drv <- JDBC("com.taosdata.jdbc.TSDBDriver", driverPath)
```
4. 创建 TDengine 数据库连接:
```r
# 创建数据库连接
conn <- dbConnect(drv, url)
```
5. 连接成功后,您可以使用 conn 对象进行各种数据库操作,如查询数据、插入数据等。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册