Merge pull request #5071 from taosdata/hotfix/TD-2541

Hotfix/td 2541
This commit is contained in:
huili 2021-01-29 09:11:18 +08:00 committed by GitHub
commit e46de616a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 42 additions and 54 deletions

View File

@ -47,7 +47,7 @@
<dependency> <dependency>
<groupId>com.taosdata.jdbc</groupId> <groupId>com.taosdata.jdbc</groupId>
<artifactId>taos-jdbcdriver</artifactId> <artifactId>taos-jdbcdriver</artifactId>
<version>2.0.4</version> <version>2.0.18</version>
</dependency> </dependency>
</dependencies> </dependencies>
@ -69,7 +69,7 @@
<configuration> <configuration>
<archive> <archive>
<manifest> <manifest>
<mainClass>com.taosdata.jdbc.example.jdbcTemplate.App</mainClass> <mainClass>com.taosdata.example.jdbcTemplate.App</mainClass>
</manifest> </manifest>
</archive> </archive>
<descriptorRefs> <descriptorRefs>

View File

@ -8,18 +8,16 @@
修改 `src/main/resources/applicationContext.xml` 文件中 TDengine 的配置信息: 修改 `src/main/resources/applicationContext.xml` 文件中 TDengine 的配置信息:
```xml ```xml
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.taosdata.jdbc.TSDBDriver"></property>
<property name="url" value="jdbc:TAOS://127.0.0.1:6030/log"></property>
<property name="username" value="root"></property>
<property name="password" value="taosdata"></property>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <bean id = "jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
<property name="driverClassName" value="com.taosdata.jdbc.TSDBDriver"></property> <property name="dataSource" ref = "dataSource" ></property>
<property name="url" value="jdbc:TAOS://127.0.0.1:6030/log"></property> </bean>
<property name="username" value="root"></property>
<property name="password" value="taosdata"></property>
</bean>
<bean id = "jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
<property name="dataSource" ref = "dataSource" ></property>
</bean>
``` ```
### 打包运行 ### 打包运行

View File

@ -1,9 +1,9 @@
package com.taosdata.jdbc.example.jdbcTemplate; package com.taosdata.example.jdbcTemplate;
import com.taosdata.jdbc.example.jdbcTemplate.dao.ExecuteAsStatement; import com.taosdata.example.jdbcTemplate.dao.ExecuteAsStatement;
import com.taosdata.jdbc.example.jdbcTemplate.dao.WeatherDao; import com.taosdata.example.jdbcTemplate.dao.WeatherDao;
import com.taosdata.jdbc.example.jdbcTemplate.domain.Weather; import com.taosdata.example.jdbcTemplate.domain.Weather;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;

View File

@ -1,4 +1,4 @@
package com.taosdata.jdbc.example.jdbcTemplate.dao; package com.taosdata.example.jdbcTemplate.dao;
public interface ExecuteAsStatement{ public interface ExecuteAsStatement{

View File

@ -1,6 +1,5 @@
package com.taosdata.jdbc.example.jdbcTemplate.dao.impl; package com.taosdata.example.jdbcTemplate.dao;
import com.taosdata.jdbc.example.jdbcTemplate.dao.ExecuteAsStatement;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

View File

@ -1,6 +1,6 @@
package com.taosdata.jdbc.example.jdbcTemplate.dao; package com.taosdata.example.jdbcTemplate.dao;
import com.taosdata.jdbc.example.jdbcTemplate.domain.Weather; import com.taosdata.example.jdbcTemplate.domain.Weather;
import java.util.List; import java.util.List;

View File

@ -1,20 +1,16 @@
package com.taosdata.jdbc.example.jdbcTemplate.dao.impl; package com.taosdata.example.jdbcTemplate.dao;
import com.taosdata.jdbc.example.jdbcTemplate.dao.WeatherDao; import com.taosdata.example.jdbcTemplate.domain.Weather;
import com.taosdata.jdbc.example.jdbcTemplate.domain.Weather; import com.taosdata.example.jdbcTemplate.dao.WeatherDao;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BatchPreparedStatementSetter; import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSourceUtils;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Repository @Repository
public class WeatherDaoImpl implements WeatherDao { public class WeatherDaoImpl implements WeatherDao {

View File

@ -1,4 +1,4 @@
package com.taosdata.jdbc.example.jdbcTemplate.domain; package com.taosdata.example.jdbcTemplate.domain;
import java.sql.Timestamp; import java.sql.Timestamp;

View File

@ -10,7 +10,7 @@
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.taosdata.jdbc.TSDBDriver"></property> <property name="driverClassName" value="com.taosdata.jdbc.TSDBDriver"></property>
<property name="url" value="jdbc:TAOS://192.168.236.137:6030/"></property> <property name="url" value="jdbc:TAOS://127.0.0.1:6030/"></property>
<property name="username" value="root"></property> <property name="username" value="root"></property>
<property name="password" value="taosdata"></property> <property name="password" value="taosdata"></property>
</bean> </bean>
@ -20,6 +20,6 @@
<property name="dataSource" ref="dataSource"></property> <property name="dataSource" ref="dataSource"></property>
</bean> </bean>
<context:component-scan base-package="com.taosdata.jdbc.example.jdbcTemplate"/> <context:component-scan base-package="com.taosdata.example.jdbcTemplate"/>
</beans> </beans>

View File

@ -1,9 +1,9 @@
package com.taosdata.jdbc.example.jdbcTemplate; package com.taosdata.example.jdbcTemplate;
import com.taosdata.jdbc.example.jdbcTemplate.dao.ExecuteAsStatement; import com.taosdata.example.jdbcTemplate.dao.ExecuteAsStatement;
import com.taosdata.jdbc.example.jdbcTemplate.dao.WeatherDao; import com.taosdata.example.jdbcTemplate.dao.WeatherDao;
import com.taosdata.jdbc.example.jdbcTemplate.domain.Weather; import com.taosdata.example.jdbcTemplate.domain.Weather;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;

View File

@ -1,18 +0,0 @@
package com.taosdata.jdbc;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
* Unit test for simple App.
*/
public class AppTest {
/**
* Rigorous Test :-)
*/
@Test
public void shouldAnswerWithTrue() {
assertTrue(true);
}
}

View File

@ -0,0 +1,13 @@
# TDengine examples
| No. | Name | Describe |
| :--: | :----------------: | ------------------------------------------------------------ |
| 1 | JDBCDemo | Example codes for JDBC-JNI, JDBC-RESTful, Subscribe |
| 2 | connectionPools | Example codes for HikariCP, Druid, dbcp, c3p0 connection pools |
| 3 | SpringJdbcTemplate | Example codes for spring jdbcTemplate |
| 4 | mybatisplus-demo | Example codes for mybatis |
| 5 | springbootdemo | Example codes for springboot |
| 6 | taosdemo | This is an internal tool for testing Our JDBC-JNI, JDBC-RESTful, RESTful interfaces |
more detail: https://www.taosdata.com/cn//documentation20/connector-java/