JDBC configuration scripts
The scripting library provides many script procedures to manage Java™ Database
Connectivity (JDBC) configurations in the environment. This page provides usage information for scripts that configure JDBC settings. We can run each script individually or combine many procedures to create custom automation scripts for the environment.
Each AdminJDBC script procedure is located in...
WAS_HOME/scriptLibraries/resources/JDBC/V70
The Jython script library provides script functions for J2C resources, JDBC providers, and JMS resources at the server scope. You can write the own custom scripts to configure resources at the cell, node, or cluster level.
Do not edit the script procedures in the script library. To write custom script library procedures, use the scripts in...
WAS_HOME/scriptLibraries
...as Jython syntax samples. Save the custom scripts to a new subdirectory to avoid overwriting the library.
Use the following script procedures to configure JDBC in the environment:
createDataSource
This script creates a new data source in the configuration. The script returns the configuration ID of the new data source. To run the script, specify the node name, server name, JDBC provider, and data source name arguments, as defined in the following table:
Table 1. createDataSource script
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. jdbcProvider Name of the JDBC provider of interest. dsName Name to assign to the new data source. attributes Optionally specifies additional parameters in the following format: [["parameter1", "value1"], ["parameter2", "value2"]].
Syntax
AdminJDBC.createDataSource(nodeName, serverName, jdbcProvider, dsName, attributes)Example usage
AdminJDBC.createDataSource("myNode", "myServer", "myJDBCProvider", "myDataSource")AdminJDBC.createDataSource("myNode", "myServer", "myJDBCProvider", "myDataSource", [["authDataAlias", "myalias"], ["authMechanismPreference", "BASIC_PASSWORD"], ["description", "testing"], ["jndiName", "dsjndi1"], ["logMissingTransactionContext", "true"], ["statementCacheSize", "5"]])
createDataSourceUsingTemplate
This script uses a template to create a new data source in the configuration.
The script returns the configuration ID of the new data source. To run the script, specify the node name, server name, JDBC provider, template ID, and data source name arguments, as defined in the following table:
Table 2. createDataSourceUsingTemplate script
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. jdbcProvider Name of the JDBC provider of interest. templateID Configuration ID of the template to use to create the data source. dsName Name to assign to the new data source. attributes Optionally specifies additional parameters in the following format: [["parameter1", "value1"], ["parameter2", "value2"]].
Syntax
AdminJDBC.createDataSourceUsingTemplate(nodeName, serverName, jdbcProvider, templateID, dsName, attributes)Example usage
AdminJDBC.createDataSourceUsingTemplate("myNode", "myServer", "myJDBCProvider", "Derby JDBC DriverDataSource(templates/system|jdbc-resource-provider-templates.xml#DataSource_derby_1)", "myDataSource")
AdminJDBC.createDataSourceUsingTemplate("myNode", "myServer", "myJDBCProvider", "Derby JDBC DriverDataSource(templates/system|jdbc-resource-provider-templates.xml#DataSource_derby_1)", "myDataSource", [["authDataAlias", "myalias"], ["authMechanismPreference", "BASIC_PASSWORD"], ["description", "testing"], ["jndiName", "dsjndi1"], ["logMissingTransactionContext", "true"], ["statementCacheSize", "5"]])
createJDBCProvider
This script creates a new JDBC provider in the environment. The script returns the configuration ID of the new JDBC provider. To run the script, specify the node name, server name, JDBC provider, and implementation class arguments, as defined in the following table:
Table 3. createJDBCProvider script
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. jdbcProvider Name to assign to the new JDBC provider. implementationClass Name of the implementation class to use. attributes Optionally specifies additional parameters in the following format: [["parameter1", "value1"], ["parameter2", "value2"]].
Syntax
AdminJDBC.createJDBCProvider(nodeName, serverName, jdbcProvider, implementationClass, attributes)Example usage
AdminJDBC.createJDBCProvider("myNode", "myServer", "myJDBCProvider", "myImplementationClass")AdminJDBC.createJDBCProvider("myNode", "myServer", "myJDBCProvider", "myImplementationClass", [["description", "testing"], ["xa", "false"], ["providerType", "provType"]])
createJDBCProviderUsingTemplate
This script uses a template to create a new JDBC provider in the environment.
To run the script, specify the node name, server name, configuration ID of the template to use, name to assign to the new JDBC provider, and the implementation class name. We can optionally specify additional attributes in the following format: [["attr1", "value1"], ["attr2", "value2"]]. The script returns the configuration ID of the new JDBC provider. To run the script, specify the node name, server name, template ID, JDBC provider name, and implementation class arguments, as defined in the following table:
Table 4. createJDBCProviderUsingTemplate script
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. templateID Configuration ID of the template to use to create the JDBC provider. jdbcProvider Name to assign to the new JDBC provider. implementationClass Name of the implementation class to use. attributes Optionally specifies additional parameters in the following format: [["parameter1", "value1"], ["parameter2", "value2"]].
Syntax
AdminJDBC.createJDBCProviderUsingTemplate(nodeName, serverName, templateID, jdbcProvider, implementationClass, attributes)Example usage
AdminJDBC.createJDBCProviderUsingTemplate("myNode", "myServer", "Derby JDBCProvider(templates/servertypes/APPLICATION_SERVER/servers/DeveloperServer|resources.xml#JDBCProvider_1124467079638)", "myJDBCProvider", "myImplementationClass")
AdminJDBC.createJDBCProviderUsingTemplate("myNode", "myServer", "Derby JDBCProvider(templates/servertypes/APPLICATION_SERVER/servers/DeveloperServer|resources.xml#JDBCProvider_1124467079638)", "myJDBCProvider", "myImplementationClass", [["description", "testing"], ["xa", "false"], ["providerType", "provType"]])
Related tasks
Use the script library to automate the application serving environment
Automating data access resource configuration using the scripting library
Related
JDBC query scripts
JMS query scripts
JMS configuration scripts
J2C configuration scripts
J2C query scripts