Hi,

Here a sample using SqlStoredComponent with Postgresql, hope it's help


<blueprint .....

 <bean id="XXXdataSource" class="org.postgresql.ds.PGSimpleDataSource">
    <property name="ServerName" 
value="unit-XXX-YYY-central-1.rds.amazonaws.com"/>
    <property name="User" value="XXXXXXX" />
    <property name="Password" value="YYYYYYY" />
    <property name="PortNumber" value="5432"/>
    <property name="DatabaseName" value="XXXYYY/>
    <property name="Ssl" value="true"/>
    <property name="sslfactory" 
value="org.postgresql.ssl.NonValidatingFactory"/>
  </bean>

<bean id="XXXSqlStored" 
class="org.apache.camel.component.sql.stored.SqlStoredComponent">
      <property name="dataSource" ref="XXXdataSource" />
</bean>

<camelContext id="Contexte-XXX-YYY" 
xmlns="http://camel.apache.org/schema/blueprint"; trace="false" >
...
...

<route id="rte.XXX.YYY">
  <from uri="direct:restSysTel" >
  <to uri="XXXSqlStored:xxx_prb_enreg_prise_appel(VARCHAR 
${header.sysTelNoTelephone}, VARCHAR ${header.sysTelIdEmploye}, VARCHAR 
${header.sysTelLangue}, VARCHAR ${header.sysTelIdFile}, VARCHAR 
${header.sysTelSessionId} )"/>
...
...
...
</route>

...
..
</camelContext>
</blueprint>


Daniel Langevin


>>> 
De :    Babak Vahdat <babak.vah...@swissonline.ch>
À :     <users@camel.apache.org>
Date :  2021-03-02 05:12
Objet :         Re: Can I call a PostgreSQL function from Camel-sql

Hi

There’s documentation about the IN, OUT and INOUT parameters for that:

https://camel.apache.org/components/latest/sql-stored-component.html#_in_parameters
 
<https://camel.apache.org/components/latest/sql-stored-component.html#_in_parameters>

Babak

> On 1 Mar 2021, at 23:49, SRIKANT MVS <srikant....@gmail.com> wrote:
> 
> Hi Team,
> I would like to call a DB function in PostgreSQL database using the
> camel-sql component. There are around 20-30 inParams that I would like to
> pass in a hashmap and get a single value in the outParams.
> 
> I am unable to find any examples for the same. Additionally, I have to make
> this call from a method, but not from a route. I couldn't find any
> references using ProducerTemplate.
> 
> Kindly share your valuable input on how I can achieve this in camel.
> 
> -Regards
> Srikant Mantha

Reply via email to