homework-jianmu/tests/examples/JDBC/connectionPools/README-cn.md

33 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

这个example中我们适配了java常见的连接池:
* c3p0
* dbcp
* druid
* HikariCP
### 说明
ConnectionPoolDemo的程序逻辑
1. 创建到host的connection连接池
2. 创建名称为pool_test的database创建表超级weather创建tableSize个子表
3. 不断向所有子表进行插入。
### 如何运行这个例子:
```shell script
# mvn exec:java -Dexec.mainClass="com.taosdata.demo.ConnectionPoolDemo" -Dexec.args="-host localhost"
```
使用mvn运行ConnectionPoolDemo的main方法可以指定参数
```shell script
Usage:
mvn exec:java -Dexec.mainClass="com.taosdata.demo.ConnectionPoolDemo" -Dexec.args="<args>"
-host : hostname
-poolType <c3p0| dbcp| druid| hikari>
-poolSize <poolSize>
-tableSize <tableSize>
-batchSize : 每条Insert SQL中values的数量
-sleep : 每次插入任务提交后的
```
### 如何停止程序:
ConnectionPoolDemo不会自己停止会一直执行插入需要手动Ctrl+C运行。
### 日志
使用log4j将日志和错误分别输出到了debug.log和error.log中