You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IoTDB provides a Java native client driver and a session pool management mechanism. These tools enable developers to interact with IoTDB using object-oriented APIs, allowing time-series objects to be directly assembled and inserted into the database without constructing SQL statements. It is recommended to use the `ITableSessionPool` for multi-threaded database operations to maximize efficiency.
24
26
25
-
## 1. Prerequisites
27
+
## 2. Usage Instructions
26
28
27
-
### 1.1 Environment Requirements
29
+
**Environment Requirements**
28
30
29
31
-**JDK**: Version 1.8 or higher
30
32
-**Maven**: Version 3.6 or higher
31
33
32
-
### 1.2 Adding Maven Dependencies
34
+
**Adding Maven Dependencies**
33
35
34
36
```XML
35
37
<dependencies>
@@ -41,13 +43,15 @@ IoTDB provides a Java native client driver and a session pool management mechani
41
43
</dependencies>
42
44
```
43
45
44
-
## 2. Read and Write Operations
46
+
## 3. Read and Write Operations
47
+
48
+
### 3.1 ITableSession Interface
45
49
46
-
###2.1 ITableSession Interface
50
+
#### 3.1.1 Feature Description
47
51
48
52
The `ITableSession` interface defines basic operations for interacting with IoTDB, including data insertion, query execution, and session closure. Note that this interface is **not thread-safe**.
@@ -57,7 +61,7 @@ The `ITableSession` interface defines basic operations for interacting with IoTD
57
61
| executeQueryStatement(String sql, long timeoutInMs) | Executes a query SQL statement with a specified timeout in milliseconds. |`sql`: The SQL query statement. `timeoutInMs`: Query timeout in milliseconds. |`SessionDataSet`|`StatementExecutionException`|
58
62
| close() | Closes the session and releases resources. | None | None | IoTDBConnectionException |
59
63
60
-
#### Sample Code
64
+
#### 3.1.3 Sample Code
61
65
62
66
```Java
63
67
/**
@@ -125,11 +129,13 @@ public interface ITableSession extends AutoCloseable {
125
129
}
126
130
```
127
131
128
-
### 2.2 TableSessionBuilder Class
132
+
### 3.2 TableSessionBuilder Class
133
+
134
+
#### 3.2.1 Feature Description
129
135
130
136
The `TableSessionBuilder` class is a builder for configuring and creating instances of the `ITableSession` interface. It allows developers to set connection parameters, query parameters, and security features.
@@ -152,7 +158,7 @@ The `TableSessionBuilder` class is a builder for configuring and creating instan
152
158
| enableCompression(boolean enableCompression) | Enables or disables RPC compression for the connection. |`false`|
153
159
| connectionTimeoutInMs(int connectionTimeoutInMs) | Sets the connection timeout in milliseconds. |`0` (no timeout) |
154
160
155
-
#### Sample Code
161
+
#### 3.2.3 Sample Code
156
162
157
163
```Java
158
164
/**
@@ -337,20 +343,22 @@ public class TableSessionBuilder {
337
343
}
338
344
```
339
345
340
-
## 3. Session Pool
346
+
## 4. Session Pool
347
+
348
+
### 4.1 ITableSessionPool Interface
341
349
342
-
###3.1 ITableSessionPool Interface
350
+
#### 4.1.1 Feature Description
343
351
344
352
The `ITableSessionPool` interface manages a pool of `ITableSession` instances, enabling efficient reuse of connections and proper cleanup of resources.
| getSession() | Acquires a session from the pool for database interaction. |`ITableSession`|`IoTDBConnectionException`|
351
359
| close() | Closes the session pool and releases resources.。 | None | None |
352
360
353
-
#### Sample Code
361
+
#### 4.1.3 Sample Code
354
362
355
363
```Java
356
364
/**
@@ -379,11 +387,13 @@ public interface ITableSessionPool {
379
387
}
380
388
```
381
389
382
-
### 3.2 TableSessionPoolBuilder Class
390
+
### 4.2 TableSessionPoolBuilder Class
391
+
392
+
#### 4.2.1 Feature Description
383
393
384
394
The `TableSessionPoolBuilder` class is a builder for configuring and creating `ITableSessionPool` instances, supporting options like connection settings and pooling behavior.
0 commit comments