<!-- One way of implementation in WSO2 Integrator -->
In Eclipse, create: WSO2 > Extensions > Project Types > Mediator Project
Code fragment:
import org.apache.synapse.mediators.AbstractMediator;
import java.sql.CallableStatement;
import java.sql.DriverManager;
public class CustomMediatorClass extends AbstractMediator {
                public boolean mediate(MessageContext msgCtxt) {
                                ...
                                Connection con = 
DriverManager.getConnection(dbURL, dbUsr, dbPswd);
                                CallableStatement cs = null;
                                …
                                cs = con.prepareCall("{call yourSP(?, ?)}");
                                cs.setString(1, spParm01); // spParms from 
msgCtxt
                                cs.setString(2, spParm02);
                                ...
                                cs.execute();
                                if (con != null && !con.isClosed()) {
                                                con.close();
                                                con = null;
                                }
                                ...
                                return true;
                }
}
Build your jar, copy to WSO2_HOME\lib\ - restart Integrator
Include in your Sequence, REST API: <class 
name="org.your-org.mediator.CustomMediatorClass"/>
ReDeploy your CompositeApp to Integrator
<!-- Hope this helps for your requirement -->

Regards
Eldrid

Including the original msg in email trail:

From: Dev <[email protected]> On Behalf Of Sanjay Bawri
Sent: 06 March 2019 20:56
To: [email protected]
Subject: [Dev] WSO EI 6.2.0 - Options to call stored procedure on 'Google Cloud 
SQL'

This email originated from outside of CGM. Please do not click links or open 
attachments unless you know the sender and know the content is safe.

Hi Team,

Can i request some information? we have a requirement to call a database stored 
procedure on 'Google Cloud SQL' to insert data, but i do not find anything from 
the WSO2 documentation. Any suggestions?

--
JSB
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to