homework-jianmu/docs/examples/JDBC/SpringJdbcTemplate
sheyanjie-qq dfd9673f0c jdbc add unsigned data types support 2025-01-22 14:32:30 +08:00
..
src move sample code to docs/example 2024-08-22 18:15:02 +08:00
.gitignore move sample code to docs/example 2024-08-22 18:15:02 +08:00
pom.xml jdbc add unsigned data types support 2025-01-22 14:32:30 +08:00
readme.md mod java code comments 2024-10-01 10:44:37 +08:00

readme.md

TDengine Spring JDBC Template Demo

Spring JDBC Template simplifies the operations of acquiring and releasing native JDBC Connections, making database operations more convenient.

Configuration

Modify the TDengine configuration in the src/main/resources/applicationContext.xml file:

<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/test"></property>
    <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>

Package and run

Navigate to the TDengine/tests/examples/JDBC/SpringJdbcTemplate directory and execute the following commands to generate an executable jar file.

mvn clean package

After successfully packaging, navigate to the target/ directory and execute the following commands to run the tests:

java -jar target/SpringJdbcTemplate-1.0-SNAPSHOT-jar-with-dependencies.jar