This documentation is for WSO2 Data Services Server 3.2.2. View documentation for the latest release.
Page Comparison - Adding an SQL Dialect (v.1 vs v.2) - Data Services Server 3.2.2 - WSO2 Documentation

Versions Compared


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


To avoid writing different data service queries for the same operation depending on the configuration, write all three SQL queries in the same data service query as shown below.

Code Block
<config id="default">
      <property name="">com.mysql.jdbc.Driver</property>
      <property name="">jdbc:mysql://localhost:3306/MyDB</property>
      <property name="">root</property>
      <property name="">password</property>
<query id="q1" useConfig="default">
      <sql>SELECT DATALENGTH(employeeNumber) FROM Employees</sql>
      <sql dialect="oracle">SELECT LENGTH(employeeNumber) FROM Employees</sql>
      <sql dialect="h2,mysql,postgresql">SELECT OCTET_LENGTH(employeeNumber) FROM Employees;</sql>
      <sql dialect="mysql">SELECT DATALENGTH(employeeNumber) FROM Employees</sql>
      <result element="Employees" rowName="Employee">
         <element column="employeeNumber" name="employeeNumber" />

Image Added

Follow the steps below to add an SQL dialect dialects to a query.

  1. The SQL dialect option appears when adding a query to data sources datasources such as RDBMS. For example,Image Removed Click the link to open the SQL Dialect window. Provide Image Added
  2. Click Add New SQL Dialect to open the SQL Dialect window. Select the required SQL driver , and define the SQL statement and Sav e. For example,Image Removedas shown below.Image Added 
    If the SQL query is statement should be the same for multiple drivers, select all drivers (e.g., MySQL, PostgreSQL and H2) at once and define the query as follows:Image Removedstatement as shown below.Image Added 
    To define an SQL dialect for a driver other than the ones listed in the supported drivers list, provide the driver prefix in the text field and define the SQL query as shown above.