Changing data source connection properties
Change the connection properties of a data source by accessing the extensionProperties array of the DataSource object. The ODA extension defines the list of connection properties that can be set at run time.
Table 37-3 describes the JDBC data source properties that affect the connection.
Table 37-3 JDBC data source run-time connection properties
Login user name
Login password
URL that identifies the data source
Driver class for accessing the data source
To change these properties, add code similar to the statements in the data source beforeOpen script in Listing 37‑16.
Listing 37‑16 Changing data source connection properties in beforeOpen
extensionProperties.odaUser = "JoeUser";
extensionProperties.odaPassword = "openSesame";
extensionProperties.odaURL = "jdbc:my_data_source:xxx";
extensionProperties.odaDriverClass = "com.companyb.jdbc.Driver";
extensionProperties.odaJndiName = "java:/MySQLDs";
extensionProperties.OdaConnProfileName = "myprofile";
extensionProperties.OdaConnProfileStorePath = "c:/conprof";
Alternatively, set these properties using the following syntax:
The beforeFactory event also supports changing connection properties as shown in Listing 37‑17.
Listing 37‑17 Changing data source connection properties in beforeFactory
report = reportContext.getDesignHandle( );
dsHandle = report.findDataSource("Data Source");
dsHandle.setProperty("odaDriverClass", "myDriver");
dsHandle.setProperty("odaURL", "myUrl");
You can also set data source and data set properties using the property binding feature in the data source editor.