IBM Worklight v5.0.5 > Develop IBM Worklight applications > Develop the server side of an IBM Worklight application > The adapter XML File

The <connectionPolicy> element of the SQL adapter

The connection policy of an SQL adapter is configured in two places:


Configure the policy in worklight.properties

In all properties, n can be 1 - 10, such as...

Property Description
custom-db.n.relative-jndi-name Relative JNDI name of the database. This is the part of the JNDI name that is prefixed by...

    java:comp/env/

For example, if the full JNDI name is...

    java:/comp/env/mydatabase

...the relative JNDI name is mydatabase.

custom-db-n.driver JDBC driver to the database. The JDBC driver of MySQL, for example, is...

    com.mysql.jdbc.Driver

The driver must be placed in...

    WORKLIGHT_PROJECT/server/lib
custom-db.n.url JDBC connection string to the database. For example:

    jdbc:mysql://localhost:3306/mydatabase
custom-db.n.username User name used to connect to the database.
custom-db.n.password User password used to connect to the database.


Configure the adapter XML file

In the adapter XML configuration file, configure the <ConnectionPolicy> element.

<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
    <dataSourceJNDIName> java:comp/env/relative-jndi-name </dataSourceJNDIName>
</connectionPolicy>

Attribute Description
xsi:type . The value of this attribute must be set to sql:SQLConnectionPolicy.

Subelement Description
dataSourceJNDIName . The JNDI name (the data source name), as defined in worklight.properties.

In the reference example, the <ConnectionPolicy> element is defined as follows:

<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<dataSourceJNDIName>java:/comp/env/bankDS</dataSourceJNDIName>
</connectionPolicy>


Parent The adapter XML File





+

Search Tips   |   Advanced Search