Click Edit Data Source next to the Connection Pool field. From the Data Source Type list, select one of the following types. Click OK.

18-12 Metadata Repository Builders Guide for Oracle Business Intelligence Enterprise Edition 2. In the Variable Manager dialog, double-click the initialization block you want to edit. You can edit Repository initialization blocks, or Session initialization blocks.

3. Click Edit Data Source next to the Connection Pool field.

4. From the Data Source Type list, select one of the following types.

■ Database: For repository and session variables. ■ LDAP Server: For session variables. ■ Custom Authenticator: For session variables. See Oracle Fusion Middleware Security Guide for Oracle Business Intelligence Enterprise Edition for more information.

5. If you selected Database for your data source type, perform one of the following

steps: ■ Select Default initialization string or Use database specific SQL, and then perform the following steps:

a. Click Browse next to the Connection Pool field to select the connection

pool associated with the database where the target information is located. If you do not select a connection pool before typing the initialization string, you receive a message prompting you to select the connection pool. b. In the Select Connection Pool dialog, select the connection pool and click Select . You must select a connection pool before typing an initialization string. By default, the first connection pool under the database object in the Phys- ical layer is not available for selection. This behavior ensures that you can- not use the same connection pool for initialization blocks that you use for queries. See About Connection Pools for Initialization Blocks for more information You can change this behavior so that the first connection pool is available for selection by selecting Allow first Connection Pool for Init Blocks in the Options dialog, although this is not recommended. See Setting Prefer- ences for more information.

c. If you selected Use database specific SQL, then in the Database pane,

expand and select the database. Then, enter its associated string. Otherwise, in the Default initialization string box, type the SQL initial- ization string needed to populate the variables. See Examples of Initial- ization Strings for examples.

d. Optional Click Test to test the data source connectivity for the SQL

statement.

e. Click OK to return to the Initialization Block dialog.

■ Select Use OBI EE Server, and then perform the following steps: a. In the box, enter the SQL initialization string needed to populate the variables. The string you enter here is processed by the Oracle BI Server, and there- fore as long as it is supported by the Oracle BI Server, the string will work with different data sources. For example, an initialization block might use the function pi, which is specific to SQL Server. However, if you select Use OBI EE Server, the query is rewritten by the Oracle BI Server for the appropriate database. In Using Variables in the Oracle BI Repository 18-13 other words, if you change the SQL Server back-end database to Oracle, the query will still work. See Examples of Initialization Strings for additional examples.

b. Click OK to return to the Initialization Block dialog.

6. If you selected LDAP Server for your data source type, perform the following

steps:

a. Click Browse to select an existing LDAP Server, or click New to open the

General tab of the LDAP Server dialog and create an LDAP Server.

b. Click OK to return to the Initialization Block dialog.

The LDAP server name and the associated domain identifier appear in the Name and Domain identifier columns. 7. If you selected Custom Authenticator for your data source type, perform the following steps:

a. Click Browse to select an existing custom authenticator, or click New to create

one.

b. Click OK to return to the Initialization Block dialog.

8. Click OK.

Examples of Initialization Strings This section contains the following initialization string examples: ■ Example 18–1, A SQL Statement When Site Uses Delivers ■ Example 18–2, A SQL Statement When Site Does Not Use Delivers ■ Example 18–3, A SQL Statement Joining Tables From Multiple Data Sources - When Using the OBI EE Server Setting Example 18–1 A SQL Statement When Site Uses Delivers SELECT username, groupname, dbname, schemaname FROM users WHERE username=:USER NQS_PASSWORD_CLAUSEand pwd=:PASSWORDNQS_PASSWORD_CLAUSE This SQL contains two constraints in the WHERE clause: :USER note the colon and single quotes is the ID the user types when logging in. :PASSWORD note the colon and single quotes is the password the user enters. This is another system variable whose presence is always assumed when the USER system session variable is used. You do not need to set up the PASSWORD variable, and you can use this variable in a database connection pool to allow passthrough login using the user ID and password of the user. You can also use this variable in a SQL statement. When using external table authentication with Delivers, the portion of the SQL statement that makes up the :PASSWORD constraint must be embedded between NQS_ PASSWORD_CLAUSE clauses. The query returns data only if the user ID and password match values found in the specified table. You should test the SQL statement outside of the Oracle BI Server, substituting valid values for the USER and PASSWORD variables and removing the NQS_PASSWORD_CLAUSE clause. 18-14 Metadata Repository Builders Guide for Oracle Business Intelligence Enterprise Edition For more information, see Oracle Fusion Middleware System Administrators Guide for Oracle Business Intelligence Enterprise Edition. Example 18–2 A SQL Statement When Site Does Not Use Delivers SELECT username, groupname, dbname, schemaname FROM users WHERE username=:USER AND pwd=:PASSWORD This SQL statement contains two constraints in the WHERE clause: :USER note the colon and the single quotes is the ID the user types when logging in. :PASSWORD note the colon and the single quotes is the password the user enters. This is another system variable whose presence is always assumed when the USER system session variable is used. You do not need to set up the PASSWORD variable, and you can use this variable in a database connection pool to allow passthrough login using the user ID and password of the user. You can also use this variable in a SQL statement. The query returns data only if the user ID and password match values found in the specified table. You should test the SQL statement outside of the Oracle BI Server, substituting valid values for the USER and PASSWORD variables. Example 18–3 A SQL Statement Joining Tables From Multiple Data Sources - When Using the OBI EE Server Setting select WUSER.name, wuser_detail.email from db-11gorcl.NAME.WUSER, sqlexpress.master.dbo.wuser_detail where username=:USER: The above query example in the initialization block uses a join query with multiple tables from different data sources for example, SQLServer, Oracle and XML Files. The query works because when you select the Use OBI EE Server option, the query is rewritten by the BI Server for the specified data sources. Testing Initialization Blocks You should test the SQL statement using the Test button or a SQL tool such as the Oracle BI Client utility. If you use a SQL tool, be sure to use the same DSN or one set up identically to the DSN in the specified connection pool. In online mode, Initialization Block tests do not work with connection pools set to use :USER and :PASSWORD as the user name and password. In offline mode, the Set values for variables dialog is displayed so that you can populate :USER and :PASSWORD. To test initialization blocks optional: 1. In the Administration Tool, select Manage, then select Variables. 2. In the Variable Manager dialog, double-click the initialization block. 3. In the [Repository|Session] Variable Initialization Block dialog, click Edit Data