private boolean executeSQL(String sql) throws TException, SQLException {
    isCancelled = false;
    TSExecuteStatementReq execReq = new TSExecuteStatementReq(sessionId, sql, stmtId);
    int rows = fetchSize;
    if (maxRows != 0 && fetchSize > maxRows) {
      rows = maxRows;
    }
    execReq.setFetchSize(rows);
    execReq.setTimeout((long) queryTimeout * 1000);
    TSExecuteStatementResp execResp =
        callWithRetryAndReconnect(
            () -> client.executeStatementV2(execReq), TSExecuteStatementResp::getStatus);

    if (execResp.isSetOperationType() && execResp.getOperationType().equals("dropDB")) {
      connection.changeDefaultDatabase(null);
    }
    try {
      RpcUtils.verifySuccess(execResp.getStatus());
    } catch (StatementExecutionException e) {
      throw new IoTDBSQLException(e.getMessage(), execResp.getStatus());
    }

    if (execResp.isSetDatabase()) {
      connection.changeDefaultDatabase(execResp.getDatabase());
    }

    if (execResp.isSetTableModel()) {
      connection.mayChangeDefaultSqlDialect(execResp.tableModel ? TABLE : TREE);
    }

    if (execResp.isSetColumns()) {
      queryId = execResp.getQueryId();
      if (execResp.queryResult == null) {
        throw new SQLException("execResp.queryResult should never be null.");
      } else {
        this.resultSet =
            new IoTDBJDBCResultSet(
                this,
                execResp.getColumns(),
                execResp.getDataTypeList(),
                execResp.columnNameIndexMap,
                execResp.isIgnoreTimeStamp(),
                client,
                sql,
                queryId,
                sessionId,
                execResp.queryResult,
                execResp.tracingInfo,
                execReq.timeout,
                execResp.moreData,
                zoneId,
                charset,
                execResp.isSetTableModel() && execResp.isTableModel(),
                execResp.getColumnIndex2TsBlockColumnIndexList());
      }
      return true;
    }
    return false;
  }
There are two kinds of sql here: (1) query sql (2) update sql.

<p>(1) return IoTDBJDBCResultSet or IoTDBNonAlignJDBCResultSet (2) simply get executed
iotdb-client/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBStatement.java