The purpose of this guide is to get you started on creating and invoking a data service using WSO2 Data Services Server (WSO2 DSS) as quickly as possible. See the following topics for details:
...
Download and install MySQL using Homebrew.
Open a terminal and execute the following command to start your MySQL database:
Code Block mysql.server start
Access the MySQL prompt by giving the user name and password. By default the user name is 'root' and the password is blank.
Code Block mysql -u root -p
Create the sample database named
employeedb
using the following command:Code Block create database employeedb;
Open the
employeedb
database you just created using the following command:Code Block use employeedb;
Create one table in the database using the following command:
Code Block create table employee(id VARCHAR(10) NOT NULL PRIMARY KEY, name VARCHAR(100), address VARCHAR(100));
This command will create the following table in the database:
Insert employee data into the
employee
table as follows:The first employee:
Code Block insert into employee values('01','john','Boston');
The second employee:
Code Block insert into employee values('02','Micheal','Dallas');
The third employee:
Code Block insert into employee values('03','richard','Chicago');
You can see the data that you have added to the
employee
table of theemployeedb
database by executing the following command:Code Block SELECT * FROM employee
The result will be as follow:
...
- Click Add New Datasource. You can now specify the datasource details.
- In the Datasource ID field, enter 'MyDS'.
- In the Datasource Type field, select RDBMS from the list of values.
- You will now be prompted to enter details of your RDBMS:
- Enter the following details of your MySQL database in the relevant fields as shown above:
- Database Engine: MySql
- Driver Class: com.mysql.jdbc.Driver
- URL: jdbc:mysql://localhost:3306/employeedb
- User Name: root
- Password: (Leave this blank)
- Click Save to save the datasource.
- Click Next. This will take you to a new page for adding queries to your service.
...
- Go to Services -> List to open the Deployed Services page.
- Click the data service (MyFirstDS) to open the service dashboard:
See that the URL of the 'MyFirstDS' data service is listed under Endpoints: https://10.100.5.65:9443/services/MyFirstDS/ - You can execute the
getEmployees
operation using the above URL. Simply copy this URL followed by the operation name as shown below.
https://10.100.5.65:9443/services/MyFirstDS/getEmployees - The result will be the same as with the TryIt tool:
...