You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by ali_khan <fa...@gmail.com> on 2008/01/24 13:09:55 UTC

creating dynamic sql in synapse configuration file

hi,
below is a section of my synapse configuration file:

..
....
<dblookup>
       <connection>
              <pool>
                   <driver>com.mysql.jdbc.Driver</driver>
                    <url>jdbc:mysql://localhost:3306/userdatabase</url>
                    <user>gge</user>
                    <password>Tes9t</password>
               </pool>
         </connection>
          <statement>
                    <sql>select * from company where name=?</sql>
                    <parameter
expression="//m0:getQuote/m0:request/m0:symbol"
                               xmlns:m0="http://services.samples/xsd"
type="VARCHAR"/>
                     <result name="company_id" column="id"/>
         </statement>
</dblookup>
....
..

As per the above configuration I want to provide a dynamic sql in place of
the static sql so that I am able to add parameters though a java program.
Is there any method by which I can access this sql in a java program and set
it there itself?
please suggest.   
-- 
View this message in context: http://www.nabble.com/creating-dynamic-sql-in-synapse-configuration-file-tp15063625p15063625.html
Sent from the Synapse - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: creating dynamic sql in synapse configuration file

Posted by Paul Fremantle <pz...@gmail.com>.
Ali

We support dynamically loading the XML from a remote resource. In
other words if the DBLookup config was in a separate XML, say on a
webserver, then if its updated, the system will pick it up.

However, I don't think that is what you want!
So....

Here is my suggestion:
Create your own mediator class. This class can "new" a
DBLookupMediator instance, and then dynamically set the DataSource,
Statement, etc onto it. In your mediator you can then call
dblookup.mediate(MessageContext).

Does that make sense?

Paul

On 1/24/08, ali_khan <fa...@gmail.com> wrote:
>
> hi,
> below is a section of my synapse configuration file:
>
> ..
> ....
> <dblookup>
>       <connection>
>              <pool>
>                   <driver>com.mysql.jdbc.Driver</driver>
>                    <url>jdbc:mysql://localhost:3306/userdatabase</url>
>                    <user>gge</user>
>                    <password>Tes9t</password>
>               </pool>
>         </connection>
>          <statement>
>                    <sql>select * from company where name=?</sql>
>                    <parameter
> expression="//m0:getQuote/m0:request/m0:symbol"
>                               xmlns:m0="http://services.samples/xsd"
> type="VARCHAR"/>
>                     <result name="company_id" column="id"/>
>         </statement>
> </dblookup>
> ....
> ..
>
> As per the above configuration I want to provide a dynamic sql in place of
> the static sql so that I am able to add parameters though a java program.
> Is there any method by which I can access this sql in a java program and set
> it there itself?
> please suggest.
> --
> View this message in context: http://www.nabble.com/creating-dynamic-sql-in-synapse-configuration-file-tp15063625p15063625.html
> Sent from the Synapse - Dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org