Work with data source properties files
Use properties files to create, modify, or delete data source properties.
Determine the changes to make to the data source configuration or its configuration objects.
Start the wsadmin scripting tool. To start wsadmin using the Jython language, run the wsadmin -lang jython command from the bin directory of the server profile.
Use a properties file to create, modify, or delete a data source object.
Run administrative commands using wsadmin to apply a properties file for a data source to the configuration, validate the properties, or delete them.
Action Procedure create Set required properties and then run the applyConfigProperties command. modify Edit required properties and then run the applyConfigProperties command. delete To delete the entire DataSource object, uncomment #DELETE=true and then run the deleteConfigProperties command. create Property Not applicable delete Property Not applicable Optionally, we can use interactive mode with the commands:
AdminTask.command_name('-interactive')
Tasks
- Create a properties file for a DataSource instance.
- Set DataSource properties as needed.
Open an editor on a DataSource properties file. Modify the Environment Variables section to match the system and set any property value that needs to be changed. An example DataSource properties file follows:
# # Header # ResourceType=DataSource ImplementingResourceType=JDBCProvider ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=myJDBCProvider:DataSource=jndiName#myDataSourceJNDI #DELETE=true # # #Properties # name=myDataSource category=null datasourceHelperClassname=com.ibm.websphere.rsadapter.DerbyDataStoreHelper authMechanismPreference=BASIC_PASSWORD #ENUM(BASIC_PASSWORD|KERBEROS) statementCacheSize=10 #integer #providerType=Derby JDBC Provider #readonly jndiName=myDataSourceJNDI relationalResourceAdapter=WebSphere Relational Resource Adapter #ObjectName(J2CResourceAdapter) xaRecoveryAuthAlias=null diagnoseConnectionUsage=false #boolean authDataAlias=null manageCachedHandles=false #boolean #provider=Derby JDBC Provider #ObjectName(JDBCProvider),readonly description=Datasource for the WebSphere Default Application logMissingTransactionContext=true #boolean EnvironmentVariablesSection #Environment Variables cellName=myCell nodeName=myNode serverName=myServer- Run the applyConfigProperties command to create or change a data source configuration.
Running the applyConfigProperties command applies the properties file to the configuration. In this Jython example, the optional -reportFileName parameter produces a report named report.txt:
AdminTask.applyConfigProperties(['-propertiesFileName myObjectType.props -reportFileName report.txt'])
- Modify an existing properties file.
- Obtain a properties file for the data source to change.
We can extract a properties file for a DataSource object using the extractConfigProperties command.
- Open the properties file in an editor and change the properties as needed.
Ensure that the environment variables in the properties file match the system.
- Run the applyConfigProperties command.
- If we no longer need the data source, we can delete the entire data source object.
Specify DELETE=true in the header section of the properties file and run the deleteConfigProperties command; for example:
AdminTask.deleteConfigProperties('[-propertiesFileName myObjectType.props -reportFileName report.txt]')
Use the properties file to configure and manage the data source object and its properties.
What to do next
Save the changes to the configuration.
Subtopics
- Work with connection pool properties files
Use properties files to create, modify, or delete connection pool properties of a data source.- Work with data source J2EE resource properties files
Use properties files to create or delete properties of data source J2EE resource property sets.
Extracting properties files Create server, cluster, application, or authorization group objects using properties files and wsadmin scripting Deleting server, cluster, application, or authorization group objects using properties files PropertiesBasedConfiguration .