title: Mule MEL to read database result-set from an second 'database outbound endpoint'
body: <p>I have a flow something like this</p>
  
  <ol>
  <li><p>A <strong>'Database inbound endpoint'</strong> which polls(for every 5 mins) to mySQL Database-Server and get result-set by a select-query (automatically this becomes the current payload i.e #[message.payload])</p></li>
  <li><p><strong>'For each'</strong> component and a <strong>'Logger'</strong>  component in it using a expression as #[message.payload]</p></li>
  <li><p>Now flow has one more <strong>'Database-out-bound-endpoint'</strong> component which executes another select-query and obtains result-set.</p></li>
  <li><p><strong>'For each'</strong> component with a <strong>'Logger'</strong>  component in it using a expression as #[message.payload]</p></li>
  </ol>
  
  <p>Note: in the loggers result-set of first DB is printing. I mean second logger is also showing result-set of first query itself.Because the result-set is storing as payload</p>
  
  <p>so, my questions are</p>
  
  <ol>
  <li><p>what is the MEL to read the result-set of second database-query in the above scenario.</p></li>
  <li><p>is there any <strong>another way to read result-set</strong> in the flow</p></li>
  </ol>
  
  <p>Here is the configuration XML</p>
  
  <pre><code>&lt;jdbc-ee:connector name="oracle_database" dataSource-ref="Oracle_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database"/&gt;
      &lt;flow name="testFileSaveFlow3" doc:name="testFileSaveFlow3"&gt;
          &lt;poll frequency="1000" doc:name="Poll"&gt;
              &lt;jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="selectTable1" queryTimeout="-1" connector-ref="oracle_database" doc:name="get data from table 1"&gt;
                  &lt;jdbc-ee:query key="selectTable1" value="SELECT * FROM TABLE1"/&gt;
              &lt;/jdbc-ee:outbound-endpoint&gt;
          &lt;/poll&gt;
          &lt;foreach doc:name="For Each"&gt;
              &lt;logger message="#[message.payload]" level="INFO" doc:name="prints result-set of table1"/&gt;
          &lt;/foreach&gt;
          &lt;jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="selectTable2" queryTimeout="-1" connector-ref="oracle_database" doc:name="get data from table 2"&gt;
              &lt;jdbc-ee:query key="selectTable2" value="SELECT * FROM TABLE2"/&gt;
          &lt;/jdbc-ee:outbound-endpoint&gt;
          &lt;foreach doc:name="For Each"&gt;
              &lt;logger message="#[message.payload]" level="INFO" doc:name="prints result-set of table2"/&gt;
          &lt;/foreach&gt;
      &lt;/flow&gt;
  </code></pre>
  
  <p>thanks in advance.</p>