Show TOC

Deploying DataSource AliasesLocate this document in the navigation structure

Use

You use this procedure to define DataSource aliases and deploy them with your applications.

A DataSource alias is a logical name mapped to the name of a real DataSource available in the system. You use the DataSource alias in your application code to connect to the underlying data source.

A DataSource alias is defined by a data-source-aliases.xml file. This XML follows the definitions of the data-source-aliases.xsd XML schema.

Procedure

To deploy a DataSource alias with a Java EE 5 application, do the following in the SAP NetWeaver Developer Studio:

  1. Add the SAP Data Source Aliases Provider Module facet to your EAR project.

    1. In the Project Explorer , select your EAR project and choose Properties from the context menu.

    2. Select Project Facets in the properties tree.

    3. Select the SAP Data Source Aliases Provider Module checkbox.

    4. Choose Apply , then choose OK .

      The Developer Studio creates the data-source-aliases.xml file under the META-INF directory of your EAR project.

    5. To open the data-source-aliases.xml file for editing, select the file and choose Open from the context menu.

  2. Fill in the elements you need to define your DataSource alias.

    For more information, see data-source-aliases.dtd .

Example

The following is an example of a data-source-aliases.xml that creates a DataSource alias to the system DataSource:

Sample Code
               <?xml version="1.0" encoding="UTF-8"?>
<data-source-aliases xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="data-source-aliases.xsd">
<application-name>ConverterEAR</application-name>
<aliases>
         <data-source-name>${com.sap.datasource.default}</data-source-name>
        <alias>CAR_RENTAL_POOL</alias>
</aliases>
</data-source-alias>