Thing which seemed very Thingish inside you is quite different when it gets out into the open and has other people looking at it

Friday, March 16, 2012

Expose your entire database as data services in two steps !!!

WSO2-Data Services Server provides the feature to expose your data as a service right away!!!. All you need to give is your database information and then generate data services to expose your database tables/schemas as per your need.

if you are using wso2 products for the first time ...
You need to download wso2 dataservices server.
Start up the server -> go to DS_HOME/bin/wso2server.bat | (DS_HOME is where your set up is located)
Once the server is up and running open a web browser and navigate to https://localhost:9443/carbon.
Login it the server using the default credentials (username=admin, password=admin).

Also note that you need to provide the related jdbc driver for the database and put in repository/component/lib in order for this feature to work.

Step 1 :- Create a data source

In order to expose your database you need to create a data source using wso2 data services server.
To create data source click on Configure -> datasources

Click on add data source and give your data base information.

Once you create your data source you can test your connection by giving a validation query (ie Select 1) to make sure your connection is successful.

Step 2 Generating data services

You can start by clicking on the generate link in the main menue. Once you click on generate you will be directed to a wizard which will ask for the datasource and the database name which will be needed to expose.

Once you create you give your database name you will get the list of schemas/tables to select for your data service.

Click on next to view the created data services

Click on finish to view the deployed services.

You can try your service by clicking on try this sample for database transactions :) You can also generate axis2 clients by clicking on the data service and going to the service dashboard.

Once you create your data service there are features to enable security, throttling and caching by going to the service dashboard as shown below.
Try your service - using the try it tool.

No comments:

Post a Comment