This documentation is for WSO2 Storage Server 1.0.3. View documentation for the latest release.
Expose data with Data Services - Storage Server 1.0.3 - WSO2 Documentation
Skip to end of metadata
Go to start of metadata


This sample demonstrates how to expose some data stored in a database created via WSO2 storage server.


Creating a data service

  1. Create a Database, a privilege template and a database user  using WSO2SS and attach the created user to the database,
  2. Use WSO2 Developer Studio and create a data service using the following values.

    Driver Classcom.mysql.jdbc.DriverThis is the driver class of the database created via WSO2 SS.
    JDBC URLjdbc:mysql://localhost:3306/wso2DB_wso2_comThis is the url received from WSO2 SS after successful creation of a database.
    User Nameuser1_aJLNWWiSThe user name of a user created in WSO2 SS, and attached to the database created.
    Passworduser1The password of the above user created in WSO2 SS, and attached to the database created.

The sample data service descriptor would be as follows.

<data enableBoxcarring="true" name="RDBMSSample" serviceNamespace="">   
	<config id="default">
	  // add the database driver of the relevant db instance created.
      <property name="">com.mysql.jdbc.Driver</property>
	  //add the database url recieved from Storage server.
      <property name="">jdbc:mysql://localhost:3306/wso2DB_wso2_com</property>
	  //add a user to connecto to the database, which is already attached to the afore mentioned database via Storage Server.
      <property name="">user1_aJLNWWiS</property>
	  //use the aforementioned users password. 	
      <property name="">user1</property>
      <property name="">1</property>
      <property name="">10</property>
      <property name="">false</property>
      <property name=""/>

   //The sample Query.
   <query id="customersInBostonSQL" useConfig="default">
      <sql>select  * from Customers where city = 'Boston' and country = 'USA'</sql>
      <result element="customers" rowName="customer">
         <element column="customerName" name="customer-name" xsdType="string"/>
         <element column="contactLastName" name="contact-last-name" xsdType="string"/>
         <element column="contactFirstName" name="contact-first-name" xsdType="string"/>
         <element column="phone" name="phone" xsdType="string"/>
         <element column="city" name="city" xsdType="string"/>
         <element column="country" name="country" xsdType="string"/>

	//The sample dataservice.
	<operation name="customersInBoston">
      <call-query href="customersInBostonSQL"/>


Executing the sample

  1. Group the created data service with a Carbon Application Project and create the Carbon Application Archive [CAR] and deploy in to the WSO2 Data Services Server.


  • No labels