Configure WebLogic DataSources
Application Release Automation: Configuring WebLogic JDBC DataSources
This section describes the configuration steps required for the WebLogic plugin, to configure a WebLogic JDBC System Resource (JDBCSystemResource). This configuration is then used during deployment to create/modify the WebLogic DataSource. A domain can contain zero or more JDBCSystemResources; the creation of just one JDBCSystemResource is shown here but this is easily extended to multiple JDBCSystemResources.
The Jython variable JDBCSystemResourceList is used to pass the list of zero or more JDBCSystemResources to be created.
Before you begin
Open or create a new Jython environment-specific configuration file. This file will contain the configuration settings that will describe the WebLogic JDBCSystemResource being created. Any change made to the JDBCSystemResource properties in this file will be reflected in the JDBCSystemResource created/modified by the tool.
About this task
This task creates the minimum set required for the creation of a WebLogic domain. Only one domain may be created per configuration file.
Procedure
Open the environment-specific py file and import the JDBCSystemResource template. This pre-populated template is typically populated with default values or None (Jython value for null) or a pre-defined name. The pre-defined names should typically be overridden in the environment-specific py file. Where a None value exists, the tool will preserve the default value setting.
from templates.JDBCSystemResourceTemplate import *
A pre-requisite is that the configuration for a Domain and an AdminServer have already been completed in the Jython file. Other pre-requisites depend on the configuration parameters used for the JDBCSystemResource, such as the Server/Cluster that the resource is targeted to. Make a copy of the JDBCSystemResource Template using the provided deepcopy function and assign an appropriate name to it; it can be any name of your choice. There can be multiple JDBCSystemResource objects and we will show afterwards how a list of your JDBCSystemResources is created.
JDBCSystemResource1 = copy.deepcopy(JDBCSystemResourceTemplate)
Change the required set of parameters of the JDBCSystemResource template copy by accessing the parameters using Jython syntax. The parameters set will reflect the JDBCSystemResource configuration that you want to create. Once the JDBCSystemResource properties are set, the instance has to be added to the JDBCSystemResource list so it's eligible for creation. The list is what is read by the tool.
JDBCSystemResourceList =[JDBCSystemResource1,]
Example
The example below shows the configuration required to create a new JDBCSystemResource with the name JDBCSystemResource1. We also show the setting of some other JDBCSystemResource parameters. Open and view the JDBCSystemResource template (JDBCSystemResourceTemplate.py) file for a list of all the parameters that may be set and to understand the syntax to be used to set each property.
Here we create a Jython dictionary object to represent the target that the resource should be deployed to. This object is then set as the target parameter of the JDBCSystemResource. Multiple targets can be added (appended) to the target parameter to deploy the resource to multiple targets (servers and clusters).
JDBCSystemResource1 = copy.deepcopy(JDBCSystemResourceTemplate) JDBCSystemResource1['Name'] = 'GenericJDBCResource' JDBCSystemResource1['JDBCResource']['Name'] = 'GenericJDBCResource' JDBCSystemResource1['JDBCResource']['JDBCDriverParams']['DriverName'] = 'oracle.jdbc.driver.OracleDriver' JDBCSystemResource1['JDBCResource']['JDBCDriverParams']['Url'] = 'jdbc:oracle:thin:@82.165.195.36:1521:XE' JDBCSystemResource1['JDBCResource']['JDBCDriverParams']['Password'] = 'system' JDBCSystemResource1['JDBCResource']['JDBCDriverParams']['Properties']['user'] = 'oracle' JDBCSystemResource1['JDBCResource']['JDBCDriverParams']['Properties']['prop1'] = 'prop1value' JDBCSystemResource1['JDBCResource']['JDBCDataSourceParams']['StreamChunkSize'] = 257 JDBCSystemResource1['JDBCResource']['JDBCDataSourceParams']['RowPrefetchSize'] = 49 JDBCSystemResource1['JDBCResource']['JDBCDataSourceParams']['RowPrefetch'] = 'true' JDBCSystemResource1['JDBCResource']['JDBCDataSourceParams']['JNDINames'] = ("a","b") target={'Name': 'MV_Cluster', 'Type': 'Clusters', } JDBCSystemResource1['Targets'].append(target) JDBCSystemResourceList=[JDBCSystemResource1,]
What to do next
You can now configure the other domain objects, such as WebLogic JMSResources and so on.