Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Install the MySQL server.
  2. Download the JDBC driver for MySQL from here and copy it to your <EI_HOME>/lib directory.
  3. Create the following database: trainingdb
  4. Create the following table:

    Code Block
    CREATE TABLE ACCOUNT(AccountID int NOT NULL,Branch varchar(255) NOT NULL, AccountNumber varchar(255),AccountType ENUM('CURRENT', 'SAVINGS') NOT NULL,
    Balance FLOAT,ModifiedDate DATE,PRIMARY KEY (AccountID)); 
  5. Enter the following data into the table:

    Code Block
    INSERT INTO ACCOUNT VALUES (1,"AOB","A00012","CURRENT",231221,'2014-12-02');

...

Anchor
step2
step2
Step 2: Adding an RDBMS datasource

Follow the steps given below.

  1. Enter the URL to your MySQL database in the URL field.
  2. Enter the username and password to connect to your MySQL database. By default the username is root and the password is blank. 

...


Step 5: Finish creating the data service

Once you have defined the operation, click Finish to complete the data service creation process. You will now be taken to the Deployed Services screen, which shows all the data services deployed on the server.


Step 6: Invoking your data service 

You can try the data service you created by using the TryIt tool that is in your product by default. 

  1. Go to the Deployed Services screen.
  2. Click the Try this service link for the RDBMS data service AccountDetailsService. The TryIt Tool will open with the data service.
  3. Select the operation you created earlier. You need to provide the account ID as an input. Enter '1'.
  4. Click Send to see the details of the account.

    Code Block
    <Entries xmlns="http://ws.wso2.org/dataservice">
       <Entry>
          <AccountID>1</AccountID>
          <Branch>AOB</Branch>
          <AccountNumber>A00012</AccountNumber>
          <AccountType>CURRENT</AccountType>
          <Balance>231221</Balance>
          <ModifiedDate>2014-12-02+05:30</ModifiedDate>
       </Entry>
    </Entries>