I'm +1 for this but it needs to be done in the context of our product unification plans, not just for WSAS.

Sanjiva.

Afkham Azeez wrote:
The real power and usefulness of data services comes from the ability to combine and query across multiple data sources. To do this in pure Java code may require 100s of lines of coding. Data services enables us to do this in a declarative manner.

We can support multiple data sources by slightly changing our current spec. Let me illustrate this with an example.

e.g.

<config name="ds1">
<property name="org.wso2.ws.dataservice.driver">com.mysql.jdbc.Driver</property> <property name="org.wso2.ws.dataservice.protocol">jdbc:mysql://localhost:3306/SAMPLE1_DB</property>
        <property name="org.wso2.ws.dataservice.user">root</property>
        <property name="org.wso2.ws.dataservice.password"></property>
</config>

<config name="ds2">
<property name="org.wso2.ws.dataservice.driver">com.mysql.jdbc.Driver</property> <property name="org.wso2.ws.dataservice.protocol">jdbc:mysql://localhost:3306/SAMPLE2_DB</property>
        <property name="org.wso2.ws.dataservice.user">root</property>
        <property name="org.wso2.ws.dataservice.password"></property>
</config>

 <query id="customersInBostonSQL">
<sql>select * from ds1.Customers where ds1.Customers.city = ds2.CUSTOMERS.city</sql>
        <result element="customers" rowName="customer">
            <element name="customer-name" column="customerName" />
            <element name="contact-last-name" column="contactLastName" />
            <element name="contact-first-name" column="contactFirstName" />
            <element name="phone" column="phone" />
            <element name="city" column="city" />
            <element name="country" column="country" />
        </result>
    </query>
...

Notice that in the above segment, two different data sources have been defined (BTW shall we replace config with dataSource?). The SQL spans across the two data sources, hence the table names have been qualified with the data source name. If only a single data source has been defined, qualifying the table names will not be necessary.

WDYT?

--
Azeez


_______________________________________________
Wsas-java-user mailing list
[EMAIL PROTECTED]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-user


--
Sanjiva Weerawarana, Ph.D.
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
email: [EMAIL PROTECTED]; cell: +1 650 265 8311 | +94 77 787 6880

"Oxygenating the Web Service Platform."

_______________________________________________
Wsas-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev

Reply via email to