I have a MySql db with ID,NAME,DATE I’d like to get these rows by using the dblookup mediator, seems not to be working, can anyone check my proxy definition please?
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Database" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<dblookup>
<connection>
<pool>
<password>1234</password>
<user>root</user>
<url>jdbc:mysql://localhost:3306/new_db</url>
<driver>com.mysql.jdbc.Driver</driver>
</pool>
</connection>
<statement>
<sql>select * from users where name=?</sql>
<result name="client_expiration" column="expiration" />
<result name="client_id" column="id" />
<result name="client_name" column="name" />
</statement>
</dblookup>
<log />
</inSequence>
</target>
</proxy>
There is an issue, when retrieve the multiple data. If we try to retrieve multiple data, it will return the first row of data. The returned value will be stored in the synapse Messagecontext. so, if you just use the log mediator you won’ be able to view the results.
Use like this;
Change your sql query like this(to retrieve one row of data)
Then log like this;