Show TOC Start of Content Area

Procedure documentation Managing Aliases  Locate the document in its SAP Library structure

Use

You can use this procedure to add, remove or redirect aliases for DataSource objects.

Aliases are alternative names that are used by the application components when they look up a DataSource object. Using aliases provides a level of independence for your applications, since you can redirect the aliases and thus use different DataSource objects without changing the application code. This enables you to manage the database connectivity for your application easily.

You can define aliases either when you create a DataSource, or additionally at runtime. All aliases that have been defined for a DataSource are visible in the Runtime tab of JDBC Connector Service in the Visual Administrator. The aliases are registered when you start the application to which the aliases are associated, and are removed when you stop the component. They become functional – that is, the system binds them in the naming – when the DataSource for which they are created is started. If you stop the component with the DataSource and the component(s) with the aliases is still running, the aliases remain registered but you cannot use them unless you start the DataSource again. You can deploy aliases with the same name and for the same DataSource in different components. Such aliases are removed only after the last component that contains a data-source-aliases.xml for them is stopped.

Procedure

Adding Aliases

You can use the following scenarios to define DataSource aliases:

·        You can define aliases when you create a DataSource using the Runtime tab of JDBC Connector Service in Visual Administrator. For more information, see Creating a DataSource with JDBC 1.x Driver and Creating a DataSource with JDBC 2.0 Driver.

·        You can add aliases for an existing DataSource at runtime using the Runtime tab of the JDBC Connector Service in the Visual Administrator:

...

                            a.      Select the DataSource for which you want to create an alias in the Resources   DataSources tree.

                            b.      On the Main tab choose Add Alias.

                            c.      Enter an arbitrary name for the alias. Choose OK.

                            d.      If you add an alias for the default DataSource, or for a DataSource that has been deployed with a service or a library, you have to restart the J2EE Engine cluster to enable the changes. You do not need to restart the cluster for DataSources deployed with applications.

·        To define aliases for a previously deployed DataSource, you can also use deploy_aliases command from DBPOOL command group. For more information, see DBPOOL.

·        You can deploy DataSource aliases with an application or library. For more information, see Registering a DataSource Alias in the Development Manual.

Redirecting Aliases

You can change the association of an alias to a DataSource at runtime using the Runtime tab of the JDBC Connector Service in the Visual Administrator.

...

       1.      Select the DataSource in the Resources   DataSources tree.

       2.      On the Main tab select the alias that you want to redirect.

       3.      Choose Redirect Alias.

       4.      Enter the name of the DataSource to which you want to redirect the alias. Choose OK.

Note

You can only redirect the alias to an existing DataSource.

       5.      If you redirect the alias to the default DataSource, or to a DataSource that has been deployed with a service or a library, you have to restart the J2EE Engine cluster to enable the changes. You do not need to restart the cluster for DataSources deployed with applications.

Removing Aliases

You can remove aliases at runtime using the Runtime tab of the JDBC Connector Service in the Visual Administrator:

...

       1.      Select the DataSource in the Resources   DataSources tree.

       2.      In the Main tab select the alias that you want to remove.

       3.      Choose Remove Alias.

       4.      If you remove an alias for the default DataSource, or for a DataSource that has been deployed with a service or a library, you have to restart the J2EE Engine cluster to enable the changes. You do not need to restart the cluster for DataSources deployed with applications.

 

 

End of Content Area