A resource reference is a logical name used by MashupHub to access a resource such as a data source. When a resource reference is bound to a data source, MashupHub users can access the data source using the resource reference name instead of directly using the data source name. For example, after a resource reference reftotestdb
is mapped to a WebSphere data source jdbc/testdb
, the data source can be accessed using the JNDI name for the resource reference java:comp/env/reftotestdb
. You need to define a data source and map a resource reference to that data source for each database that is set up with trusted context.
To create a resource reference, edit the web.xml
file in each
of the following locations:
Follow these steps to edit each web.xml
file to add a resource reference. Before proceeding, make a backup copy of the web.xml
- Open the web.xml file in a text editor.
- Add the following code for each resource reference:
<description>Trusted Context 1</description>
The content in the <description>
tag is optional.
The tag <res-ref-name>
is required. You will use the contents of this tag when you map the resource reference to the data source.
Do not change the code or the content of these tags: <res-type>
, and <res-sharing-scope>
- Close and save the web.xml file.
You do not need to restart the server after updating the web.xml
files. The resource references will be listed under Mashup Hub
application in the WebSphere administrative console.
Trusted users can create feeds using the JNDI name for the resource reference mapped to the data source that is enabled for trusted context. For example, if the resource reference name is trusted_context1
, the JNDI name to use when you create the feed will be java:comp/env/trusted_context1
. When making the database connection, the WebSphere Application Server uses the identity of the logged-in user, provided that user is one of the trusted users.
If a trusted user has been defined with the WITH AUTHENTICATION
option, WebSphere Application Server uses the custom DataStoreHelper class to pass in the user's password.
Example of DB2 trusted context configuration for a single server: imc3
This example shows how to configure DB2 trusted context for enterprise database feeds for a single server.