readme.md 1.3 KB
Newer Older
Z
change  
zyyang 已提交
1
# How to Run the JDBC Demo Code On Linux OS
J
johnnyhou327 已提交
2
TDengine's JDBC demo project is organized in a Maven way so that users can easily compile, package and run the project. If you don't have Maven on your server, you may install it using
Z
change  
zyyang 已提交
3 4 5 6
```
sudo apt-get install maven
```

Z
zyyang 已提交
7 8 9
## Install TDengine Client
Make sure you have already installed a tdengine client on your current develop environment.
Download the tdengine package on our website: ``https://www.taosdata.com/cn/all-downloads/`` and install the client.
J
johnnyhou327 已提交
10

Z
change  
zyyang 已提交
11
## Run jdbcDemo using mvn plugin
Z
zyyang 已提交
12
run command:
Z
change  
zyyang 已提交
13
```
Z
change  
zyyang 已提交
14
mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JDBCDemo"
Z
change  
zyyang 已提交
15 16
```

Z
zyyang 已提交
17
and run with your customed args
Z
change  
zyyang 已提交
18
```
Z
change  
zyyang 已提交
19
mvn clean compile exec:java -Dexec.mainClass="com.taosdata.example.JDBCDemo" -Dexec.args="-host [HOSTNAME]"
Z
change  
zyyang 已提交
20
```
Z
zyyang 已提交
21

J
johnnyhou327 已提交
22
## Compile the Demo Code and Run It
Z
change  
zyyang 已提交
23
To compile taos-jdbcdriver, go to the source directory ``TDengine/src/connector/jdbc`` and execute
Z
change  
zyyang 已提交
24 25
```
mvn clean package -Dmaven.test.skip=true
Z
change  
zyyang 已提交
26
```
Z
change  
zyyang 已提交
27

Z
change  
zyyang 已提交
28 29
To compile the demo project, go to the source directory ``TDengine/tests/examples/JDBC/JDBCDemo`` and execute
```
Z
zyyang 已提交
30
mvn clean package assembly:single
Z
change  
zyyang 已提交
31
```
Z
zyyang 已提交
32

Z
change  
zyyang 已提交
33
To run JDBCDemo.jar, go to ``TDengine/tests/examples/JDBC/JDBCDemo`` and execute
Z
change  
zyyang 已提交
34
```
Z
change  
zyyang 已提交
35
java -Djava.ext.dirs=../../../../src/connector/jdbc/target:$JAVA_HOME/jre/lib/ext -jar target/JDBCDemo-SNAPSHOT-jar-with-dependencies.jar -host [HOSTNAME]
Z
change  
zyyang 已提交
36
```
Z
zyyang 已提交
37