I have created a JIRA issue (https://wso2.org/jira/browse/WSAS-716) to keep track of the progress of this issue.

Azeez

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-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev



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

Reply via email to