tree: 2b10b11f7649564d2e8666bf8bcc8d101e2e4d80 [path history] [tgz]
  1. src/
  2. pom.xml
  3. README.md
iotdb-spring-boot-starter/README.md

iotdb-spring-boot-starter

  • After ‘clone’ the project, execute ‘mvn clean install’. This step is not necessary as it has already been uploaded to the Maven central repository

  • Add the following configuration to the ‘pom’ file of the project to be generated:

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.iotdb</groupId>
            <artifactId>iotdb-spring-boot-starter</artifactId>
            <version>2.0.3</version>
        </dependency>
    </dependencies>
  • Use The target Bean with @Autowired like:
        @Autowired
        private ITableSessionPool ioTDBSessionPool;

        public void queryTableSessionPool() throws IoTDBConnectionException, StatementExecutionException {
            ITableSession tableSession = ioTDBSessionPool.getSession();
            final SessionDataSet sessionDataSet = tableSession.executeQueryStatement("select * from table1 limit 10");
            while (sessionDataSet.hasNext()) {
                final RowRecord rowRecord = sessionDataSet.next();
                final List<Field> fields = rowRecord.getFields();
                for (Field field : fields) {
                    System.out.print(field.getStringValue());
                }
                System.out.println();
            }
        }