Uploaded image for project: 'Mule'
  1. Mule
  2. MULE-3496

Expressions in JDBC Queries are not evaluated

    Details

    • Type: Patch submission
    • Status: Closed
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.x Backlog
    • Component/s: Transport: JDBC
    • Labels:
      None
    • User impact:
      High
    • Configuration:
      Hide
      <?xml version="1.0" encoding="UTF-8"?>
      <mule xmlns="http://www.mulesource.org/schema/mule/core/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xmlns:spring="http://www.springframework.org/schema/beans" xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.0"
      	xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.0"
      	xmlns:jdbc="http://www.mulesource.org/schema/mule/jdbc/2.0"
      	xsi:schemaLocation="
                     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                     http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd
                     http://www.mulesource.org/schema/mule/jdbc/2.0 http://www.mulesource.org/schema/mule/jdbc/2.0/mule-jdbc.xsd
                     http://www.mulesource.org/schema/mule/vm/2.0 http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd
                     http://www.mulesource.org/schema/mule/stdio/2.0 http://www.mulesource.org/schema/mule/stdio/2.0/mule-stdio.xsd
                     ">
      
      	<description>This is a template.</description>
      
      	<spring:beans>
      		<spring:import resource="spring-applicationContext.xml" />
      	</spring:beans>
      
      	<vm:connector name="vmConnector" queueEvents="false" />
      	<jdbc:connector name="jdbcConnector" dataSource-ref="driverManagedDataSource">
      		<jdbc:query key="getFoo1" value="SELECT * from foo WHERE age=23 AND status=${header:status}"/>
      	</jdbc:connector>
      
      	<model name="testModel">
      		<service name="testService">
      			<inbound>
      				<vm:inbound-endpoint path="in" connector-ref="vmConnector" />
      			</inbound>
      			<component class="components.JdbcComponent"></component>
      			<outbound>
      				<outbound-pass-through-router>
      					<stdio:outbound-endpoint system="OUT" />
      				</outbound-pass-through-router>
      			</outbound>
      		</service>
      	</model>
      </mule>
      
      Show
      <?xml version= "1.0" encoding= "UTF-8" ?> <mule xmlns= "http://www.mulesource.org/schema/mule/core/2.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:spring = "http://www.springframework.org/schema/beans" xmlns:vm = "http://www.mulesource.org/schema/mule/vm/2.0" xmlns:stdio = "http://www.mulesource.org/schema/mule/stdio/2.0" xmlns:jdbc = "http://www.mulesource.org/schema/mule/jdbc/2.0" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.mulesource.org/schema/mule/core/2.0 http://www.mulesource.org/schema/mule/core/2.0/mule.xsd http://www.mulesource.org/schema/mule/jdbc/2.0 http://www.mulesource.org/schema/mule/jdbc/2.0/mule-jdbc.xsd http://www.mulesource.org/schema/mule/vm/2.0 http://www.mulesource.org/schema/mule/vm/2.0/mule-vm.xsd http://www.mulesource.org/schema/mule/stdio/2.0 http://www.mulesource.org/schema/mule/stdio/2.0/mule-stdio.xsd "> <description> This is a template. </description> <spring:beans> <spring:import resource= "spring-applicationContext.xml" /> </spring:beans> <vm:connector name= "vmConnector" queueEvents= "false" /> <jdbc:connector name= "jdbcConnector" dataSource-ref= "driverManagedDataSource" > <jdbc:query key= "getFoo1" value= "SELECT * from foo WHERE age=23 AND status=${header:status}" /> </jdbc:connector> <model name= "testModel" > <service name= "testService" > <inbound> <vm:inbound-endpoint path= "in" connector-ref= "vmConnector" /> </inbound> <component class= "components.JdbcComponent" > </component> <outbound> <outbound-pass-through-router> <stdio:outbound-endpoint system= "OUT" /> </outbound-pass-through-router> </outbound> </service> </model> </mule>
    • Similar Issues:

      Description

      I have a component which reads from a JDBC query, by passing in a message with headers (i.e. in the example below, "status"):

      public Object onCall(MuleEventContext eventContext) throws Exception {
      	EndpointURI uri = new MuleEndpointURI("jdbc://getFoo1");
      	MuleMessage response = eventContext.sendEvent(eventContext.getMessage(), uri);
      	Object result = response.getPayload();
      
      	return result;
      }
      

      It's not evaluated, see patch.

        Attachments

        1. JdbcConnector.java
          11 kB
        2. JdbcConnector.class
          10 kB
        3. DIFF
          0.7 kB

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              yuenchi.lian Yuen-Chi Lian
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                5/Sep/08