change
This commit is contained in:
parent
9b67864f56
commit
2839d49757
|
@ -1,23 +1,25 @@
|
||||||
这个example中,我们适配了java常见的连接池:
|
这个example中,我们适配了java常见的连接池:
|
||||||
* c3p0
|
* HikariCP(默认)
|
||||||
* dbcp
|
|
||||||
* druid
|
* druid
|
||||||
* HikariCP
|
* dbcp
|
||||||
|
* c3p0
|
||||||
|
|
||||||
### 说明
|
### 说明
|
||||||
ConnectionPoolDemo的程序逻辑:
|
ConnectionPoolDemo的程序逻辑:
|
||||||
1. 创建到host的connection连接池
|
1. 创建到host的connection连接池
|
||||||
2. 创建名称为pool_test的database,创建表超级weather,创建tableSize个子表
|
2. 创建名称为pool_test的database,创建表超级weather,创建tableSize个子表
|
||||||
3. 不断向所有子表进行插入。
|
3. 总共插入totalNumber条数据。
|
||||||
|
|
||||||
### 如何运行这个例子:
|
### 如何运行这个例子:
|
||||||
|
|
||||||
```shell script
|
```shell script
|
||||||
# mvn exec:java -Dexec.mainClass="com.taosdata.example.ConnectionPoolDemo" -Dexec.args="-host localhost"
|
mvn clean package assembly:single
|
||||||
|
java -jar target/connectionPools-1.0-SNAPSHOT-jar-with-dependencies.jar -host 127.0.0.1
|
||||||
```
|
```
|
||||||
使用mvn运行ConnectionPoolDemo的main方法,可以指定参数
|
使用mvn运行ConnectionPoolDemo的main方法,可以指定参数
|
||||||
```shell script
|
```shell script
|
||||||
Usage:
|
Usage:
|
||||||
mvn exec:java -Dexec.mainClass="com.taosdata.example.ConnectionPoolDemo" -Dexec.args="<args>"
|
java -jar target/connectionPools-1.0-SNAPSHOT-jar-with-dependencies.jar
|
||||||
-host : hostname
|
-host : hostname
|
||||||
-poolType <c3p0| dbcp| druid| hikari>
|
-poolType <c3p0| dbcp| druid| hikari>
|
||||||
-poolSize <poolSize>
|
-poolSize <poolSize>
|
||||||
|
@ -26,8 +28,5 @@ mvn exec:java -Dexec.mainClass="com.taosdata.example.ConnectionPoolDemo" -Dexec.
|
||||||
-sleep : 每次插入任务提交后的
|
-sleep : 每次插入任务提交后的
|
||||||
```
|
```
|
||||||
|
|
||||||
### 如何停止程序:
|
|
||||||
ConnectionPoolDemo不会自己停止,会一直执行插入,需要手动Ctrl+C运行。
|
|
||||||
|
|
||||||
### 日志
|
### 日志
|
||||||
使用log4j,将日志和错误分别输出到了debug.log和error.log中
|
使用log4j,将日志和错误分别输出到了debug.log和error.log中
|
Loading…
Reference in New Issue