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.
To deploy a DataSource alias with a Java EE 5 application, do the following in the SAP NetWeaver Developer Studio:
Add the SAP Data Source Aliases Provider Module facet to your EAR project.
In the Project Explorer , select your EAR project and choose Properties from the context menu.
Select Project Facets in the properties tree.
Select the SAP Data Source Aliases Provider Module checkbox.
Choose Apply , then choose OK .
The Developer Studio creates the data-source-aliases.xml file under the META-INF directory of your EAR project.
To open the data-source-aliases.xml file for editing, select the file and choose Open from the context menu.
Fill in the elements you need to define your DataSource alias.
For more information, see data-source-aliases.dtd .
The following is an example of a data-source-aliases.xml that creates a DataSource alias to the system DataSource:
<?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>