All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Update the document based on the installer experience.

...

Follow the steps given below to set up a MySQL database for this tutorial.

  1. Download the product installer from here, and run the installer.
    Excerpt Include
    Installing the Product
    Installing the Product
    nopaneltrue
  2. Install the MySQL server.
  3. Download the JDBC driver for MySQL from here and copy it to your <EI_HOME>/lib directory.
  4. Set up a database for storing information of offices:
    1. Create a database called OfficeDetails.

      Code Block
      CREATE DATABASE OfficeDetails;
    2. Create the Offices table:

      Code Block
      USE OfficeDetails;
      
      CREATE TABLE `Offices` (`OfficeCode` int(11) NOT NULL, `AddressLine1` varchar(255) NOT NULL, `AddressLine2` varchar(255) DEFAULT NULL, `City` varchar(255) DEFAULT NULL, `State` varchar(255) DEFAULT NULL, `Country` varchar(255) DEFAULT NULL, `Phone` varchar(255) DEFAULT NULL, PRIMARY KEY (`OfficeCode`));
  5. Set up a database to store the employee information:
    1. Create a database called EmployeeDetails.

      Code Block
      CREATE DATABASE EmployeeDetails;
    2. Create the Employees table:

      Code Block
      USE EmployeeDetails;
      
      CREATE TABLE `Employees` (`EmployeeNumber` int(11) NOT NULL, `FirstName` varchar(255) NOT NULL, `LastName` varchar(255) DEFAULT NULL, `Email` varchar(255) DEFAULT NULL, `JobTitle` varchar(255) DEFAULT NULL, `OfficeCode` int(11) NOT NULL, PRIMARY KEY (`EmployeeNumber`));

...

Let's create a data service using the Create Data Service wizard:

  1. Open a terminal, navigate to the <EI_HOME>/bin directory, and start Start the WSO2 ESB profile.

    Panel
    borderColor#542989
    bgColor
    Linux/Mac./integrator.shWindowsintegrator.bat --run
    #ffffff
    borderWidth1
    Localtab Group
    Localtab
    activetrue
    titleOn MacOS/Linux/CentOS

    Open a terminal and execute the following command:

    Code Block
    wso2ei-6.4.0-integrator
    Localtab
    titleOn Windows
    Go to Start Menu -> Programs -> WSO2 -> Enterprise Integrator 6.4.0 Integrator. This will open a terminal and start the ESB profile.
  2. Access the management console of the ESB profile: https://localhost:9443/carbon
  3. Sign in using admin as the username and password.
  4. On the Data Service menu click Create.
  5. Add a name for the data service and click Next.
  6. Select the Enable Boxcarring and Disable Legacy Boxcarring Mode check boxes.

    Note
    titleWhat is Boxcarring and Request Box?

    Boxcarring is a method of grouping a set of service calls so that they can be executed as a group (i.e., the individual service calls will be executed consecutively in the specified order). Note that we have now deprecated the boxcarring method for data services. Instead, we have replaced boxcarring with a new request type called request_box

    Request box is simply a wrapper element (request_box), which wraps the service calls that need to be invoked. When the request_box is invoked, the individual service calls will be executed in the specified order, and the result of the last service call in the list will be returned. In this tutorial, we are using the request box to invoke the following two service calls:

    1. Add a new employee to the database
    2. Get details of the office of the added employee

    When you click the Enable Boxcarring check box for the data service, both of the above functions (Boxcarring and Request box) are enabled. However, since boxcarring is deprecated in the product, it is recommended to disable boxcarring by clicking the Disable Legacy Boxcarring Mode check box.

  7. Click Next to go to the Datasources screen.
  8. Click Add New Datasource to create a datasource connection for the OfficeDetails database:

    Datasource IdEnter XAoffices as the datasource ID.
    Datasource Type

    Select RDBMS as the datasource type and s elect External Datasource from the adjoining field.

    Database Engine

    Select MySQL.

    Datasource Class Name

    Enter the database class that corresponds to MysqlXADataSource.class.
    Example: For MySQL 5, enter  com.mysql.jdbc.jdbc2.optional.MysqlXADataSource

    Tip

    Make sure to check the path of the MysqlXADataSource.class and enter the updated path here. Else, you run into errors.

    Add New Property

    Specify the following connection settings for the OfficeDetails database:

    Property NameValue
    urljdbc:mysql://localhost:3306/OfficeDetails
    userEnter your MySQL server's username.
    Example: root
    passwordOptionally: Enter your MySQL server's password. 
    If you have not assigned a password, do not add this property.

    Example: The New Datasource screen will now look as follows:

  9. Save the XAoffices datasource.
  10. Click Add New Datasource to create a datasource connection for the EmployeeDetails database as follows:

    Datasource IdEnter XAemployees as the datasource ID.
    Datasource Type

    Select RDBMS as the datasource type and select External Datasource from the adjoining field.

    Database Engine

    Select MySQL.

    Datasource Class Name

    Enter the database class that corresponds to MysqlXADataSource.class.
    Example: For MySQL 5, enter com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.

    Tip

    Make sure to check the path of the MysqlXADataSource.class and enter the updated path here. Else, you run into errors.

    Add New Property

    Specify the following connection settings for the EmployeeDetails database:

    Property NameValue
    urljdbc:mysql://localhost:3306/EmployeeDetails
    userEnter your MySQL server's username.
    Example: root
    passwordOptionally:Enter your MySQL server's password. 
    If you have not assigned a password, do not add this property.

    Example: The New Datasource screen now look as follows:

  11. Save the XAemployees datasource and click Next.

...