private void executeInitSql() throws SQLException {
    if (initFile != null) {
      try (Statement st = createStatement()) {
        List<String> sqlList = parseInitFile(initFile);
        for(String sql : sqlList) {
          boolean hasResult = st.execute(sql);
          if (hasResult) {
            try (ResultSet rs = st.getResultSet()) {
              while (rs.next()) {
                System.out.println(rs.getString(1));
              }
            }
          }
        }
      } catch(Exception e) {
        LOG.error("Failed to execute initial SQL");
        throw new SQLException(e.getMessage());
      }
    }
  }
Create a new connection that shares the same session ID as the current connection.
jdbc/src/java/org/apache/hive/jdbc/HiveConnection.java