Data Services spanning across multiple data surces
--------------------------------------------------

                 Key: WSAS-716
                 URL: http://wso2.org/jira/browse/WSAS-716
             Project: WSO2 WSAS
          Issue Type: New Feature
          Components: data-services
            Reporter: Afkham Azeez
         Assigned To: sumedha rubasinghe


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. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://wso2.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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

Reply via email to