+

Search Tips   |   Advanced Search

JDBC configuration scripts

The scripting library provides many script procedures to manage JDBC configurations in the environment. See the 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 the app_server_root/scriptLibraries/resources/JDBC/V70 directory.

Beginning with Version 7, the Jython script library provides script functions for JDBC providers, JMS resources, and resource providers at the server scope. We can write our own custom scripts to configure resources at the cell, node, or cluster level.

Avoid trouble: Do not edit the script procedures in the script library. To write custom script library procedures, use the scripts in the app_server_root/scriptLibraries directory as Jython syntax samples. Save the custom scripts to a new subdirectory to avoid overwriting the library.gotcha

Fast path: Beginning with Fix Pack 5, the Jython script library provides script functions for JDBC providers, JMS resources, and resource providers at the cell, node, server, or cluster scope. Resource providers include mail providers, URL providers, and resource environment providers. You do not have to write custom scripts to configure resources at a particular scope.

The example usage scripts and the script syntax are split on multiple lines for printing purposes.

Use the following script procedures to configure JDBC in the environment:


Format for the scope argument

The scope format applies to the scripts in the script library that have the scope argument.

A cell is optional on node, server, and cluster scopes. A node is required on the server scope.

We can delimit the type by using a comma (,) or a colon (:). We can use lower case for the type (cell=, node=, server=, or cluster=.)

The examples in the following table are split on multiple lines for publishing purposes.

path, configuration ID, and type for a particular scope. The
Scope Containment path Configuration ID Type
Cell /Cell:myCell/
myCell(cells/myCell|
cell.xml#Cell_1)
Cell=myCell or cell=myCell
Node /Cell:myCell/Node:myNode/ or /Node:myNode/
myNode(cells/myCell
/nodes/myNode|
node.xml#Node_1)

    Cell=myCell, Node=myNode

or

Cell=myCell:
Node=myNode
or

    cell=myCell, node=myNode

Server
/Cell:myCell/Node:
myNode/
Server:myServer/
or
/Node:myNode/Server:
myServer/
myServer(cells
/myCell/
nodes/myNode/
servers/myServer|
server.xml#Server_1)

    Cell=myCell, Node=myNode, Server=myServer

or

Node=myNode:
Server=myServer
or

    cell=myCell, Node=myNode, Server=myServer

Cluster
/Cell:myCell/
ServerCluster:
myCluster/
or
/ServerCluster:
myCluster/
myCluster(cells
/myCell/clusters/
myCluster|
cluster.xml
#ServerCluster_1)

    Cell=myCell, Cluster=myCluster

or

Cell=myCell:
Cluster=myCluster
or

    cell=myCell, Cluster=myCluster


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. We can optionally specify attributes. The arguments and attributes are defined in the following tables:

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 attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

Attributes Description Example
authDataAlias Alias used for database authentication at run time.

    ['authDataAlias', 'myAuthDataAlias']

authMechanismPreference Authentication mechanism. Valid values are BASIC_PASSWORD for basic authentication and KERBEROS for Kerberos authentication.
category Category that can be used to classify or group the resource.

    ['category', 'myCategory']

connectionPool Specifies the JDBC connection pooling properties for the parent JDBC connection factory instance.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["connectionPool",[["agedTimeout","100"], ["connectionTimeout","1000"], ["freePoolDistributionTableSize",10], ["maxConnections","12"],["minConnections","5"], ["numberOfFreePoolPartitions","3"], ["numberOfSharedPoolPartitions","6"], ["numberOfUnsharedPoolPartitions","3"], ["properties",[["description","My description"], ["name","myName"],[" required","false"],["type","String"], ["validationExpression",""],["value","myValue"]]], ["purgePolicy","EntirePool"],["reapTime","10000"], ["struckThreshold","3"],["struckTime","10"], ["struckTimerTime","10"],["surgeCreationInterval","10"], ["surgeThreshold","10"],["testConnection","true"], ["testConnectionInterval","10"], ["unusedTimeout","10000"]]]

datasourceHelperClassname Name of the DataStoreHelper implementation class that extends the capabilities of the implementation class of the JDBC driver. The extended capabilities allow the JDBC drive to perform functions that are specific to the data.
com.ibm.websphere.rsadapter.DB2DataStoreHelper
com.ibm.websphere.rsadapter.DerbyDataStoreHelper
...
description Specifies a description of the data source.

    ['description', 'My description']

jndiName Specifies the JNDI name for this data source.

    ['jndiName', 'myJndiName']

logMissingTransactionContext Whether missing transaction context logging is enabled.

    ['logMissingTransactionContext', 'false']

manageCachedHandles Whether this data source is used for container-managed persistence of enterprise beans. The default value is true.

    ['manageCachedHandles', 'false']

mapping Mapping of the configuration login to a specified authentication alias name.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["mapping",[["authDataAlias","authDataAliasValue"], ["mappingConfigAlias","mappingConfigAliasValue"]]]

preTestConfig Pretest connection configuration settings.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["preTestConfig",[["preTestConnection", "true"], "retryInterval", "12343"],"retryLimit", "4"]]]

properties Specifies either a typed property type or a descriptive property type.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["properties",[["description","My description"], ["name", "myName"]," required","false"], ["type","String"],["validationExpression",""], "value','myValue"]]]

propertySet Optionally specifies resource properties in the following format: [propertySet[[resourceProperties[[[name1 nameValue1][type1 typeValue1][value1 valueValue1]]... [[namen nameValuen][typen typeValuen][valuen valueValuen]] ]]]]

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

[propertySet [[resourceProperties  [[name databaseName][type string][value mys]]  [name driverType][type integer][value 4]]  [name serverName][type string][value localhost]]
[[name portNumber][type integer][value 50000]] ]]]]
relationalResourceAdapter Relational resource adapter that the data source uses. The available Java 2 Connector (J2C) resource adapter ID of J2CResourceAdapterID can be identified with the AdminConfig.list ('J2CResourceAdapter') command.
[relationalResourceAdapter "WebSphere Relational Resource  Adapter(cells/pongo/nodes/pongo/servers/server1|
resources.xml#builtin_rra)"]
statementCacheSize Number of statements that the product can cache for each connection. The product optimizes the processing of prepared statements and callable statements by caching statements that are not used in an active connection. Both statement types improve the performance of transactions between an application and a datastore. Caching the statements makes them more readily available.

    ['statementCacheSize', 5]

xaRecoveryAuthAlias Database authentication alias used during XA recovery processing. When this property is specified, the default value is the alias for application authentication.

    ['-xaRecoveryAuthAlias', 'myCellManager01/a1']

attributes, continued. The providerType attribute is
Attributes Description Example
providerType Specifies the JDBC provider type that this JDBC provider uses.

    ['providerType', 'DB2 Using IBM JCC Driver']

Syntax

providerType optional attribute

Syntax

Use the following command syntax to find the JDBC provider type name. Only JDBC provider template IDs containing the templates/system|jdbc-resource-provider-templates.xml substring have valid JDBC Provider type names. The JDBC provider type name and its substring form the JDBC provider template ID.

Example partial result showing the JDBC provider template ID for the JDBC provider type name of Derby JDBC Provider (XA):

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)

Some JDBC provider template IDs:

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)
DB2 Legacy CLI-based Type 2 JDBC Driver (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_4)
DB2 UDB for iSeries (Native - V5R1 and earlier)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_5)"
DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)

Example usage

The following example script contains required attributes only:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:

AdminJDBC.createDataSource("IBM-F4A849C57A0Node01", "server1", "My JDBC Name2", "MyJDBCDS",  [['authDataAlias', 'cellManager01/myAuthDataAlias'], ['authMechanismPreference', 'BASIC_PASSWORD'],  ['category', 'myCategory'], ['connectionPool', [['agedTimeout', 100],  ['connectionTimeout', 1000], ['freePoolDistributionTableSize', 10], ['maxConnections', 12], ['minConnections', 5],  ['numberOfFreePoolPartitions', 3], ['numberOfSharedPoolPartitions', 6], ['numberOfUnsharedPoolPartitions', 3],  ['properties', [[['name', 'name1a'], ['value', 'value1a']], [['name', 'name1b'], ['value', 'value1b']]]],  ['purgePolicy', 'EntirePool'], ['reapTime', 10000], ['stuckThreshold', 3], ['stuckTime', 10], ['stuckTimerTime', 10],  ['surgeThreshold', 10], ['testConnection', 'true']]], ['datasourceHelperClassname',  'com.ibm.websphere.rsadapter.DB2DataStoreHelper'],  ['description', 'My description'], ['diagnoseConnectionUsage', 'true'], ['jndiName', 'myJndiName'],  ['logMissingTransactionContext', 'false'],  ['manageCachedHandles', 'false'], ['mapping', [['authDataAlias', 'anAlias'], ['mappingConfigAlias', 'anotherTest']]],  ['preTestConfig', [['preTestConnection', 'true'], ['retryInterval', 12343], ['retryLimit', 4]]], ['properties',  [[['name', 'name1'], ['value', 'value1']], [['name', 'name2'], ['value', 'value2']]]], ['propertySet',  [['resourceProperties', [[['name', 'databaseName'], ['type', 'String'], ['value', 'myDbName']], [['name', 'driverType'],  ['type', 'integer'], ['value', 4]], [['name', 'serverName'], ['type', 'String'], ['value', 'localhost']],  [['name', 'portNumber'], ['type', 'integer'], ['value', 50000]]]]]], ['providerType', 'DB2 Using IBM JCC Driver'],  ['relationalResourceAdapter', 'SIB JMS Resource Adapter
(cells/IBM-F4A849C57A0Cell01/nodes/IBM-F4A849C57A0Node01/servers/server1|resources.xml#J2CResourceAdapter_1232911649746)'],  ['statementCacheSize', 5], ['xaRecoveryAuthAlias', 'myCellManager01/xa1']])


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. We can optionally specify attributes. The arguments and attributes are defined in the following tables:

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 attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

Attributes Description Example
authDataAlias Alias used for database authentication at run time.

    ['authDataAlias', 'myAuthDataAlias']

authMechanismPreference Authentication mechanism. Valid values are BASIC_PASSWORD for basic authentication and KERBEROS for Kerberos authentication.
category Category that can be used to classify or group the resource.

    ['category', 'myCategory']

connectionPool Specifies the JDBC connection pooling properties for the parent JDBC connection factory instance.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["connectionPool",[["agedTimeout","100"], ["connectionTimeout","1000"], ["freePoolDistributionTableSize",10], ["maxConnections","12"],["minConnections","5"], ["numberOfFreePoolPartitions","3"], ["numberOfSharedPoolPartitions","6"], ["numberOfUnsharedPoolPartitions","3"], ["properties",[["description","My description"], ["name","myName"],[" required","false"],["type","String"], ["validationExpression",""],["value","myValue"]]], ["purgePolicy","EntirePool"],["reapTime","10000"], ["struckThreshold","3"],["struckTime","10"], ["struckTimerTime","10"],["surgeCreationInterval","10"], ["surgeThreshold","10"],["testConnection","true"], ["testConnectionInterval","10"], ["unusedTimeout","10000"]]]

datasourceHelperClassname Name of the DataStoreHelper implementation class that extends the capabilities of the implementation class of the JDBC driver. The extended capabilities allow the JDBC drive to perform functions that are specific to the data.
com.ibm.websphere.rsadapter.DB2DataStoreHelper
com.ibm.websphere.rsadapter.DerbyDataStoreHelper
...
description Specifies a description of the data source.

    ['description', 'My description']

jndiName Specifies the JNDI name for this data source.

    ['jndiName', 'myJndiName']

logMissingTransactionContext Whether missing transaction context logging is enabled.

    ['logMissingTransactionContext', 'false']

manageCachedHandles Whether this data source is used for container-managed persistence of enterprise beans. The default value is true.

    ['manageCachedHandles', 'false']

mapping Mapping of the configuration login to a specified authentication alias name.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["mapping",[["authDataAlias","authDataAliasValue"], ["mappingConfigAlias","mappingConfigAliasValue"]]]

preTestConfig Pretest connection configuration settings.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["preTestConfig",[["preTestConnection", "true"], "retryInterval", "12343"],"retryLimit", "4"]]]

properties Specifies either a typed property type or a descriptive property type.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["properties",[["description","My description"], ["name", "myName"]," required","false"], ["type","String"],["validationExpression",""], "value','myValue"]]]

propertySet Optionally specifies resource properties in the following format: [propertySet[[resourceProperties[[[name1 nameValue1][type1 typeValue1][value1 valueValue1]]... [[namen nameValuen][typen typeValuen][valuen valueValuen]] ]]]]

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

[propertySet [[resourceProperties  [[name databaseName][type string][value mys]]  [name driverType][type integer][value 4]]  [name serverName][type string][value localhost]]
[[name portNumber][type integer][value 50000]] ]]]]
relationalResourceAdapter Relational resource adapter that the data source uses. The available Java 2 Connector (J2C) resource adapter ID of J2CResourceAdapterID can be identified with the AdminConfig.list('J2CResourceAdapter') command.
[relationalResourceAdapter "WebSphere Relational Resource  Adapter(cells/pongo/nodes/pongo/servers/server1|
resources.xml#builtin_rra)"]
statementCacheSize Number of statements that the product can cache for each connection. The product optimizes the processing of prepared statements and callable statements by caching statements that are not used in an active connection. Both statement types improve the performance of transactions between an application and a datastore. Caching the statements makes them more readily available.

    ['statementCacheSize', 5]

xaRecoveryAuthAlias Database authentication alias used during XA recovery processing. When this property is specified, the default value is the alias for application authentication.

    ['-xaRecoveryAuthAlias', 'myCellManager01/a1']

Attributes Description Example
providerType Specifies the JDBC provider type that this JDBC provider uses.

    ['providerType', 'DB2 Using IBM JCC Driver']

Syntax

providerType optional attribute

Syntax

Use the following command syntax to find the JDBC provider type name. Only JDBC provider template IDs containing the templates/system|jdbc-resource-provider-templates.xml substring have valid JDBC Provider type names. The JDBC provider type name and its substring form the JDBC provider template ID.

Example partial result showing the JDBC provider template ID for the JDBC provider type name of Derby JDBC Provider (XA):

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)

Some JDBC provider template IDs:

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)
DB2 Legacy CLI-based Type 2 JDBC Driver (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_4)
DB2 UDB for iSeries (Native - V5R1 and earlier)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_5)"
DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)

Example usage

The following example script contains required attributes only:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:


createDataSourceAtScope

This script creates a new data source in the configuration at the scope specified. The script returns the configuration ID of the new data source. The script procedure uses the createDatasource administrative command to create a new data source. The createDataSource script creates a new data source using the AdminConfig create command.

To run the script, specify the scope, JDBC provider, data source name, and database name arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:

Argument Description
scope Specifies a scope of cell, node, server, or cluster for the JDBC provider.
JDBCName Name of the JDBC provider of interest.
datasourceName Name to assign to the new data source.
jndiName Specifies the JNDI name for this data source.
dataStoreHelperClassName Name of the DataStoreHelper implementation class that extends the capabilities of the selected JDBC driver implementation class to perform data-specific functions.
dbName (URL for the Oracle database) Name to assign the database for the JDBC provider.

For a JDBC provider that uses the Oracle database, the argument specifies the URL of the database from which the datasource obtains connections. Examples are jdbc:oracle:thin:@localhost:1521:sample for a thin driver and jdbc:oracle:oci8:@sample for a thick driver.

otherAttributes

Optionally specifies additional attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

resoureAttributes

Optionally specifies additional attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

failonerror Administrative utilities that process an error condition.

Attributes Description
category Category that can be used to classify or group the resource.
componentManagedAuthenticationAlias Alias used for database authentication at runtime.
containerManagedPersistence Specifies containinger managed persistence is enabled when set to true.
description Specifies a description of the data source.
xaRecoveryAuthAlias Database authentication alias used during XA recovery processing. When this property is specified, the default value is the alias for application authentication.

Attributes Description
driverType Data source type. The data source type is valid only for JDBC providers that have a database type of DB2.
portNumber Port number of the database server. The port number is valid only for JDBC providers that have a database type of DB2, Informix, Sybase, or SQLServer.
serverName Host name of the database server or IP address. The server name is valid only for JDBC providers that have a database type of DB2, Informix, Sybase, or SQLServer.
ifxIFHOST Connection wait time for obtaining a lock on the database. By default, the Informix database returns an error when it cannot acquire a lock, rather than wait for the current owner of the lock to release it. To modify the behavior, set the property to the number of seconds to wait for a lock. The default is 2 seconds. Any negative value translates into an unlimited wait time. This attribute is valid only for JDBC providers that have a database type of Informix.
informixLockModeWait Physical machine name of the server hosting the Informix instance. We can enter a host name or IP address. We can also enter an Internet Protocol Version 6 (IPv6) if the host database supports it. This attribute is valid only for JDBC providers that have a database type of Informix.

Syntax

Example usage

The following example script contains required attributes only:

Examples scripts for the DB2 database type:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:

Examples scripts for the Derby database:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:

Examples scripts for the Informix database:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:

Examples scripts for the Oracle database:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:

Examples scripts for the SQLServer database:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:

Examples scripts for the Sybase database:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:


createDataSourceUsingTemplateAtScope

This script uses a template to create a new data source in the configuration at the scope specified. The script returns the configuration ID of the new data source.

To run the script, specify the scope, JDBC provider, template ID, and data source name arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:

Argument Description
scope Specifies a scope of cell, node, server, or cluster for the JDBC provider.
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 attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

Attributes Description Example
authDataAlias Alias used for database authentication at run time.

    ['authDataAlias', 'myAuthDataAlias']

authMechanismPreference Authentication mechanism. Valid values are BASIC_PASSWORD for basic authentication and KERBEROS for Kerberos authentication.
category Category that can be used to classify or group the resource.

    ['category', 'myCategory']

connectionPool Specifies the JDBC connection pooling properties for the parent JDBC connection factory instance.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["connectionPool",[["agedTimeout","100"], ["connectionTimeout","1000"], ["freePoolDistributionTableSize",10], ["maxConnections","12"],["minConnections","5"], ["numberOfFreePoolPartitions","3"], ["numberOfSharedPoolPartitions","6"], ["numberOfUnsharedPoolPartitions","3"], ["properties",[["description","My description"], ["name","myName"],[" required","false"],["type","String"], ["validationExpression",""],["value","myValue"]]], ["purgePolicy","EntirePool"],["reapTime","10000"], ["struckThreshold","3"],["struckTime","10"], ["struckTimerTime","10"],["surgeCreationInterval","10"], ["surgeThreshold","10"],["testConnection","true"], ["testConnectionInterval","10"], ["unusedTimeout","10000"]]]

datasourceHelperClassname Name of the DataStoreHelper implementation class that extends the capabilities of the implementation class of the JDBC driver. The extended capabilities allow the JDBC drive to perform functions that are specific to the data.
com.ibm.websphere.rsadapter.DB2DataStoreHelper
com.ibm.websphere.rsadapter.DerbyDataStoreHelper
...
description Specifies a description of the data source.

    ['description', 'My description']

jndiName Specifies the JNDI name for this data source.

    ['jndiName', 'myJndiName']

logMissingTransactionContext Whether missing transaction context logging is enabled.

    ['logMissingTransactionContext', 'false']

manageCachedHandles Whether this data source is used for container-managed persistence of enterprise beans. The default value is true.

    ['manageCachedHandles', 'false']

mapping Mapping of the configuration login to a specified authentication alias name.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["mapping",[["authDataAlias","authDataAliasValue"], ["mappingConfigAlias","mappingConfigAliasValue"]]]

preTestConfig Pretest connection configuration settings.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["preTestConfig",[["preTestConnection", "true"], "retryInterval", "12343"],"retryLimit", "4"]]]

properties Specifies either a typed property type or a descriptive property type.

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    ["properties",[["description","My description"], ["name", "myName"]," required","false"], ["type","String"],["validationExpression",""], "value','myValue"]]]

propertySet Optionally specifies resource properties in the following format: [propertySet[[resourceProperties[[[name1 nameValue1][type1 typeValue1][value1 valueValue1]]... [[namen nameValuen][typen typeValuen][valuen valueValuen]] ]]]]

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

[propertySet [[resourceProperties  [[name databaseName][type string][value mys]]  [name driverType][type integer][value 4]]  [name serverName][type string][value localhost]]
[[name portNumber][type integer][value 50000]] ]]]]
relationalResourceAdapter Relational resource adapter that the data source uses. The available Java 2 Connector (J2C) resource adapter ID of J2CResourceAdapterID can be identified with the AdminConfig.list('J2CResourceAdapter') command.
[relationalResourceAdapter "WebSphere Relational Resource  Adapter(cells/pongo/nodes/pongo/servers/server1|
resources.xml#builtin_rra)"]
statementCacheSize Number of statements that the product can cache for each connection. The product optimizes the processing of prepared statements and callable statements by caching statements that are not used in an active connection. Both statement types improve the performance of transactions between an application and a datastore. Caching the statements makes them more readily available.

    ['statementCacheSize', 5]

xaRecoveryAuthAlias Database authentication alias used during XA recovery processing. When this property is specified, the default value is the alias for application authentication.

    ['-xaRecoveryAuthAlias', 'myCellManager01/a1']

Attributes Description Example
providerType Specifies the JDBC provider type that this JDBC provider uses.

    ['providerType', 'DB2 Using IBM JCC Driver']

Syntax

providerType optional attribute

Syntax

Use the following command syntax to find the JDBC provider type name. Only JDBC provider template IDs containing the templates/system|jdbc-resource-provider-templates.xml substring have valid JDBC Provider type names. The JDBC provider type name and its substring form the JDBC provider template ID.

Example partial result showing the JDBC provider template ID for the JDBC provider type name of Derby JDBC Provider (XA):

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)

Some JDBC provider template IDs:

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)
DB2 Legacy CLI-based Type 2 JDBC Driver (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_4)
DB2 UDB for iSeries (Native - V5R1 and earlier)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_5)"
DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)

Example usage

The following example script contains required attributes only:

The following example script includes optional attributes in a string format:

The following example script includes optional attributes in a list format:


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. We can optionally specify attributes. The arguments and attributes are defined in the following tables:

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 attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

Attributes Description Example
classpath List of paths or JAR file names which together form the location for the resource provider classes. Use a semicolon (;) to separate class paths.
['-classpath', '${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;
${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar']
description Specifies a description of the resource adapter.

    ['description', 'My description']

isolatedClassLoader If set to true, specifies that the resource provider is loaded in its own class loader.

A provider cannot be isolatedClassLoader when a native library path is specified.

    ['isolatedClassLoader', 'false']

nativepath Specifies an optional path to any native libraries, such as *.dll and *.so. Native path entries are separated by a semicolon (;).

    ['-nativepath', '${DB2_JCC_DRIVER_NATIVEPATH}']

Attributes Description Example
propertySet Optionally specifies resource properties in the following format: [propertySet[[resourceProperties[[[name1 nameValue1][type1 typeValue1][value1 valueValue1]]... [[namen nameValuen][typen typeValuen][valuen valueValuen]] ]]]]

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    [propertySet [[resourceProperties [[[name databaseName][type string][value mys]] [[name driverType][type integer][value 4]] [[name serverName][type string][value localhost]] [[name portNumber][type integer][value 50000]] ]]]]

providerType Specifies the JDBC provider type that this JDBC provider uses.

    ['providerType', 'DB2 Universal JDBC Driver Provider']

xa Possible values are true and false. If set to true, data sources for the provider produce connections that applications use in two-phase commit, global transactions. If set to false, the data sources produce connections that applications use in single-phase commit, local transactions.
true
 false

Syntax

Implementation class optional attribute

Syntax

Use the following command syntax to find the implementationClassName attribute by specifying the JDBC provider template ID for JDBCProvID:

    AdminConfig.showAttribute(JDBCProvID,'implementationClassName')

implementationClassName attribute example usage:

print AdminConfig.showAttribute("DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)", "implementationClassName")
Result:

    com.ibm.db2.jcc.DB2XADataSource

Some possible implementation class names:

  • com.ibm.db2.jcc.DB2ConnectionPoolDataSource

  • com.ibm.db2.jcc.DB2XADataSource

  • com.ibm.db2.jdbc.app.UDBConnectionPoolDataSource

  • com.ibm.db2.jdbc.app.UDBXADataSource

  • com.ibm.as400.access.AS400JDBCConnectionPoolDataSource

  • com.ibm.as400.access.AS400JDBCXADataSource

  • org.apache.derby.jdbc.ClientConnectionPoolDataSource

  • org.apache.derby.jdbc.ClientXADataSource

  • org.apache.derby.jdbc.ClientConnectionPoolDataSource40

  • org.apache.derby.jdbc.ClientXADataSource40

  • org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40

  • org.apache.derby.jdbc.EmbeddedXADataSource40

  • org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource

  • org.apache.derby.jdbc.EmbeddedXADataSource

  • com.informix.jdbcx.IfxConnectionPoolDataSource

  • com.informix.jdbcx.IfxXADataSource oracle.jdbc.pool.OracleConnectionPoolDataSource

  • oracle.jdbc.xa.client.OracleXADataSource

  • com.sybase.jdbc3.jdbc.SybConnectionPoolDataSource

  • com.sybase.jdbc3.jdbc.SybXADataSource

  • com.sybase.jdbc4.jdbc.SybConnectionPoolDataSource

  • com.sybase.jdbc4.jdbc.SybXADataSource

  • com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource

  • com.microsoft.sqlserver.jdbc.SQLServerXADataSource

  • com.ddtek.jdbcx.sqlserver.SQLServerDataSource

providerType optional attribute

Syntax

Use the following command syntax to find the JDBC provider type name. Only JDBC provider template IDs containing the templates/system|jdbc-resource-provider-templates.xml substring have valid JDBC Provider type names. The JDBC provider type name and its substring form the JDBC provider template ID.

Example partial result showing the JDBC provider template ID for the JDBC provider type name of Derby JDBC Provider (XA):

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)

Some JDBC provider template IDs:

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)
DB2 Legacy CLI-based Type 2 JDBC Driver (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_4)
DB2 UDB for iSeries (Native - V5R1 and earlier)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_5)"
DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)

Example usage

The following example script contains required attributes only:

The following example script includes optional attributes in a string format:

AdminJDBC.createJDBCProvider("IBM-F4A849C57A0Node01", "server1", "My JDBC Name",  "com.ibm.db2.jcc.DB2ConnectionPoolDataSource",  " classpath=${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;
${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar,  description='My description', isolatedClassLoader=false, nativepath=${DB2_JCC_DRIVER_NATIVEPATH},  providerType='DB2 Univesal JDBC Driver Provider', xa=true ") 

The following example script includes optional attributes in a list format:

AdminJDBC.createJDBCProvider("IBM-F4A849C57A0Node01", "server1", "My JDBC Name",  "com.ibm.db2.jcc.DB2ConnectionPoolDataSource",  [['classpath', '${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;
${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar'],  ['description', 'My description'], ['isolatedClassLoader', 'false'], ['nativepath', '${DB2_JCC_DRIVER_NATIVEPATH}'],  ['providerType', 'DB2 Univesal JDBC Driver Provider'], ['xa', 'true'], ['propertySet', [['resourceProperties',  [[['name', 'databaseName'], ['type', 'String'], ['value', 'myDbName']], [['name', 'driverType'], ['type', 'integer'],  ['value', 4]], [['name', 'serverName'], ['type', 'String'], ['value', 'localhost']], [['name', 'portNumber'],  ['type', 'Integer'], ['value', 50000]]]]]]])


createJDBCProviderUsingTemplate

This script uses a template to create 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, template ID, JDBC provider name, and implementation class arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:

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 attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

Attributes Description Example
classpath List of paths or JAR file names which together form the location for the resource provider classes. Use a semicolon (;) to separate class paths.
['-classpath', '${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;
${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar']
description Specifies a description of the resource adapter.

    ['description', 'My description']

isolatedClassLoader If set to true, specifies that the resource provider is loaded in its own class loader.

A provider cannot be isolatedClassLoader when a native library path is specified.

    ['isolatedClassLoader', 'false']

nativepath Specifies an optional path to any native libraries, such as *.dll and *.so. Native path entries are separated by a semicolon (;).

    ['-nativepath', '${DB2_JCC_DRIVER_NATIVEPATH}']

Attributes Description Example
propertySet Optionally specifies resource properties in the following format: [propertySet[[resourceProperties[[[name1 nameValue1][type1 typeValue1][value1 valueValue1]]... [[namen nameValuen][typen typeValuen][valuen valueValuen]] ]]]]

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    [propertySet [[resourceProperties [[[name databaseName][type string][value mys]] [[name driverType][type integer][value 4]] [[name serverName][type string][value localhost]] [[name portNumber][type integer][value 50000]] ]]]]

providerType Specifies the JDBC provider type that this JDBC provider uses.

    ['providerType', 'DB2 Universal JDBC Driver Provider']

xa Possible values are true and false. If set to true, data sources for the provider produce connections that applications use in two-phase commit, global transactions. If set to false, the data sources produce connections that applications use in single-phase commit, local transactions.
true
 false

Syntax

Implementation class optional attribute

Syntax

Use the following command syntax to find the implementationClassName attribute by specifying the JDBC provider template ID for JDBCProvID:

    AdminConfig.showAttribute(JDBCProvID,'implementationClassName')

implementationClassName attribute example usage:

print AdminConfig.showAttribute("DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)", "implementationClassName")
Result:

    com.ibm.db2.jcc.DB2XADataSource

Some possible implementation class names:

  • com.ibm.db2.jcc.DB2ConnectionPoolDataSource

  • com.ibm.db2.jcc.DB2XADataSource

  • com.ibm.db2.jdbc.app.UDBConnectionPoolDataSource

  • com.ibm.db2.jdbc.app.UDBXADataSource

  • com.ibm.as400.access.AS400JDBCConnectionPoolDataSource

  • com.ibm.as400.access.AS400JDBCXADataSource

  • org.apache.derby.jdbc.ClientConnectionPoolDataSource

  • org.apache.derby.jdbc.ClientXADataSource

  • org.apache.derby.jdbc.ClientConnectionPoolDataSource40

  • org.apache.derby.jdbc.ClientXADataSource40

  • org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40

  • org.apache.derby.jdbc.EmbeddedXADataSource40

  • org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource

  • org.apache.derby.jdbc.EmbeddedXADataSource

  • com.informix.jdbcx.IfxConnectionPoolDataSource

  • com.informix.jdbcx.IfxXADataSource oracle.jdbc.pool.OracleConnectionPoolDataSource

  • oracle.jdbc.xa.client.OracleXADataSource

  • com.sybase.jdbc3.jdbc.SybConnectionPoolDataSource

  • com.sybase.jdbc3.jdbc.SybXADataSource

  • com.sybase.jdbc4.jdbc.SybConnectionPoolDataSource

  • com.sybase.jdbc4.jdbc.SybXADataSource

  • com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource

  • com.microsoft.sqlserver.jdbc.SQLServerXADataSource

  • com.ddtek.jdbcx.sqlserver.SQLServerDataSource

providerType optional attribute

Syntax

Use the following command syntax to find the JDBC provider type name. Only JDBC provider template IDs containing the templates/system|jdbc-resource-provider-templates.xml substring have valid JDBC Provider type names. The JDBC provider type name and its substring form the JDBC provider template ID.

Example partial result showing the JDBC provider template ID for the JDBC provider type name of Derby JDBC Provider (XA):

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)

Some JDBC provider template IDs:

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)
DB2 Legacy CLI-based Type 2 JDBC Driver (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_4)
DB2 UDB for iSeries (Native - V5R1 and earlier)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_5)"
DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)

Example usage

The following example script contains required attributes only:

The following example script includes optional attributes in a string format:

AdminJDBC.createJDBCProviderUsingTemplate("IBM-F4A849C57A0Node01", "server1",  "DB2 Universal JDBC Driver Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_1)",  "My JDBC Name", "com.ibm.db2.jcc.DB2ConnectionPoolDataSource",  "classpath= ${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar,  description='My description', isolatedClassLoader=false, nativepath=${DB2_JCC_DRIVER_NATIVEPATH},  providerType='DB2 Univesal JDBC Driver Provider', xa=true ") 

The following example script includes optional attributes in a list format:

AdminJDBC.createJDBCProviderUsingTemplate("IBM-F4A849C57A0Node01", "server1",  "DB2 Universal JDBC Driver Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_1)", My JDBC Name",  "com.ibm.db2.jcc.DB2ConnectionPoolDataSource",  [['classpath', '${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar'],  ['description', 'My description'], ['isolatedClassLoader', 'false'], ['nativepath', '${DB2_JCC_DRIVER_NATIVEPATH}'],  ['providerType', 'DB2 Univesal JDBC Driver Provider'], ['xa', 'true'], ['propertySet', [['resourceProperties',  [[['name', 'databaseName'], ['type', 'String'], ['value', 'myDbName']], [['name', 'driverType'], ['type', 'integer'],  ['value', 4]], [['name', 'serverName'], ['type', 'String'], ['value', 'localhost']], [['name', 'portNumber'],  ['type', 'Integer'], ['value', 50000]]]]]]])


createJDBCProviderAtScope

This script creates a new JDBC provider in the environment at the scope specified. The script returns the configuration ID of the new JDBC provider. The script procedure uses the createJDBCProvider administrative command to create a new JDBC provider. The createJDBCProvider script procedure creates a new JDBC provider using the AdminConfig create command.

To run the script, specify the scope, JDBC provider, database type, provider type, and implementation types arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:

Argument Description
scope Specifies a scope of cell, node, server, or cluster for the JDBC provider.
databaseType Database type that this JDBC provider uses. Valid values include DB2, Derby, Informix, Oracle, Sybase, SQL Server, and user-defined values.
providerType Specifies the JDBC provider type that this JDBC provider uses.
implType Implementation type that this JDBC provider uses. Valid values are Connection pool datasource and XA data source.
jdbcProvider Name to assign to the new JDBC provider.
attributes

Optionally specifies additional attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

Attributes Description Example
classpath List of paths or JAR file names which together form the location for the resource provider classes. Use a semicolon (;) to separate class paths.
['-classpath', '${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;
${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar']
description Specifies a description of the resource adapter.

    ['description', 'My description']

isolatedClassLoader If set to true, specifies that the resource provider is loaded in its own class loader.

A provider cannot be isolatedClassLoader when a native library path is specified.

    ['isolatedClassLoader', 'false']

nativepath Specifies an optional path to any native libraries, such as *.dll and *.so. Native path entries are separated by a semicolon (;).

    ['-nativepath', '${DB2_JCC_DRIVER_NATIVEPATH}']

Attributes Description
implementationClassName Specifies the implementation class to use for a given JDBC provider template.

providerType optional attribute

Syntax

Use the following command syntax to find the JDBC provider type name. Only JDBC provider template IDs containing the templates/system|jdbc-resource-provider-templates.xml substring have valid JDBC Provider type names. The JDBC provider type name and its substring form the JDBC provider template ID.

Example partial result showing the JDBC provider template ID for the JDBC provider type name of Derby JDBC Provider (XA):

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)

Some JDBC provider template IDs:

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)
DB2 Legacy CLI-based Type 2 JDBC Driver (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_4)
DB2 UDB for iSeries (Native - V5R1 and earlier)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_5)"
DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)

implementationClassName attribute

Syntax

Use the following command syntax to find the implementationClassName attribute by specifying the JDBC provider template ID for JDBCProvID:

    AdminConfig.showAttribute(JDBCProvID,'implementationClassName')

implementationClassName attribute example usage:

print AdminConfig.showAttribute("DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)", "implementationClassName")
Result:

    com.ibm.db2.jcc.DB2XADataSource

Some possible implementation class names:

  • com.ibm.db2.jcc.DB2ConnectionPoolDataSource

  • com.ibm.db2.jcc.DB2XADataSource

  • com.ibm.db2.jdbc.app.UDBConnectionPoolDataSource

  • com.ibm.db2.jdbc.app.UDBXADataSource

  • com.ibm.as400.access.AS400JDBCConnectionPoolDataSource

  • com.ibm.as400.access.AS400JDBCXADataSource

  • org.apache.derby.jdbc.ClientConnectionPoolDataSource

  • org.apache.derby.jdbc.ClientXADataSource

  • org.apache.derby.jdbc.ClientConnectionPoolDataSource40

  • org.apache.derby.jdbc.ClientXADataSource40

  • org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40

  • org.apache.derby.jdbc.EmbeddedXADataSource40

  • org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource

  • org.apache.derby.jdbc.EmbeddedXADataSource

  • com.informix.jdbcx.IfxConnectionPoolDataSource

  • com.informix.jdbcx.IfxXADataSource oracle.jdbc.pool.OracleConnectionPoolDataSource

  • oracle.jdbc.xa.client.OracleXADataSource

  • com.sybase.jdbc3.jdbc.SybConnectionPoolDataSource

  • com.sybase.jdbc3.jdbc.SybXADataSource

  • com.sybase.jdbc4.jdbc.SybConnectionPoolDataSource

  • com.sybase.jdbc4.jdbc.SybXADataSource

  • com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource

  • com.microsoft.sqlserver.jdbc.SQLServerXADataSource

  • com.ddtek.jdbcx.sqlserver.SQLServerDataSource

createJDBCProviderAtScope script

Syntax

Example usage

The following example script contains required attributes only:

The following example script includes optional attributes in a string format:

AdminJDBC.createJDBCProviderAtScope("/Cell:IBM-F4A849C57A0Cell01/Node:IBM-F4A849C57A0Node01", "DB2",  "DB2 Universal JDBC Driver Provider", "Connection pool data source", "My JDBCProvider Name",  "description='My description', implementationClassName=com.ibm.db2.jcc.DB2ConnectionPoolDataSource,  classpath=${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar,  nativePath=${DB2_JCC_DRIVER_NATIVEPATH}, isolatedClassLoader=false")

The following example script includes optional attributes in a list format:

AdminJDBC.createJDBCProviderAtScope("/Cell:IBM-F4A849C57A0Cell01/Node:IBM-F4A849C57A0Node01", "DB2",  "DB2 Universal JDBC Driver Provider", "Connection pool data source", "My JDBCProvider Name", [['description', 'My description'], [ 'implementationClassName ', 'com.ibm.db2.jcc.DB2ConnectionPoolDataSource'], [ 'classpath', '${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar'], [ 'nativePath', '${DB2_JCC_DRIVER_NATIVEPATH}'], ['isolatedClassLoader', 'false'] ])


createJDBCProviderUsingTemplateAtScope

This script uses a template to create a new JDBC provider in the environment at the scope specified. The script returns the configuration ID of the new JDBC provider.

To run the script, specify the scope, template ID, JDBC provider name, and implementation class arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:

Argument Description
scope Specifies a scope of cell, node, server, or cluster for the JDBC provider.
templateID Configuration ID of the template to use to create the JDBC provider.
jdbcProvider Name to assign to the new JDBC provider.
implementationClassName Name of the implementation class to use.
attributes

Optionally specifies additional attributes in a particular format:

List format

[["attr1", "value1"], ["attr2", "value2"]]

String format

"attr1=value1, attr2=value2"

Attributes Description Example
classpath List of paths or JAR file names which together form the location for the resource provider classes. Use a semicolon (;) to separate class paths.
['-classpath', '${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;
${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar']
description Specifies a description of the resource adapter.

    ['description', 'My description']

isolatedClassLoader If set to true, specifies that the resource provider is loaded in its own class loader.

A provider cannot be isolatedClassLoader when a native library path is specified.

    ['isolatedClassLoader', 'false']

nativepath Specifies an optional path to any native libraries, such as *.dll and *.so. Native path entries are separated by a semicolon (;).

    ['-nativepath', '${DB2_JCC_DRIVER_NATIVEPATH}']

Attributes Description Example
propertySet Optionally specifies resource properties in the following format: [propertySet[[resourceProperties[[[name1 nameValue1][type1 typeValue1][value1 valueValue1]]... [[namen nameValuen][typen typeValuen][valuen valueValuen]] ]]]]

When you use this attribute in a script, use the list format. The string format does not work because this attribute is a configuration object type.

    [propertySet [[resourceProperties [[[name databaseName][type string][value mys]] [[name driverType][type integer][value 4]] [[name serverName][type string][value localhost]] [[name portNumber][type integer][value 50000]] ]]]]

providerType Specifies the JDBC provider type that this JDBC provider uses.

    ['providerType', 'DB2 Universal JDBC Driver Provider']

xa Possible values are true and false. If set to true, data sources for the provider produce connections that applications use in two-phase commit, global transactions. If set to false, the data sources produce connections that applications use in single-phase commit, local transactions.
true
 false

Implementation class optional attribute

Syntax

Use the following command syntax to find the implementationClassName attribute by specifying the JDBC provider template ID for JDBCProvID:

    AdminConfig.showAttribute(JDBCProvID,'implementationClassName')

implementationClassName attribute example usage:

print AdminConfig.showAttribute("DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)", "implementationClassName")
Result:

    com.ibm.db2.jcc.DB2XADataSource

Some possible implementation class names:

  • com.ibm.db2.jcc.DB2ConnectionPoolDataSource

  • com.ibm.db2.jcc.DB2XADataSource

  • com.ibm.db2.jdbc.app.UDBConnectionPoolDataSource

  • com.ibm.db2.jdbc.app.UDBXADataSource

  • com.ibm.as400.access.AS400JDBCConnectionPoolDataSource

  • com.ibm.as400.access.AS400JDBCXADataSource

  • org.apache.derby.jdbc.ClientConnectionPoolDataSource

  • org.apache.derby.jdbc.ClientXADataSource

  • org.apache.derby.jdbc.ClientConnectionPoolDataSource40

  • org.apache.derby.jdbc.ClientXADataSource40

  • org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource40

  • org.apache.derby.jdbc.EmbeddedXADataSource40

  • org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource

  • org.apache.derby.jdbc.EmbeddedXADataSource

  • com.informix.jdbcx.IfxConnectionPoolDataSource

  • com.informix.jdbcx.IfxXADataSource oracle.jdbc.pool.OracleConnectionPoolDataSource

  • oracle.jdbc.xa.client.OracleXADataSource

  • com.sybase.jdbc3.jdbc.SybConnectionPoolDataSource

  • com.sybase.jdbc3.jdbc.SybXADataSource

  • com.sybase.jdbc4.jdbc.SybConnectionPoolDataSource

  • com.sybase.jdbc4.jdbc.SybXADataSource

  • com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource

  • com.microsoft.sqlserver.jdbc.SQLServerXADataSource

  • com.ddtek.jdbcx.sqlserver.SQLServerDataSource

providerType optional attribute

Syntax

Use the following command syntax to find the JDBC provider type name. Only JDBC provider template IDs containing the templates/system|jdbc-resource-provider-templates.xml substring have valid JDBC Provider type names. The JDBC provider type name and its substring form the JDBC provider template ID.

Example partial result showing the JDBC provider template ID for the JDBC provider type name of Derby JDBC Provider (XA):

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)

Some JDBC provider template IDs:

Derby JDBC Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Derby_4)
DB2 Legacy CLI-based Type 2 JDBC Driver (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_4)
DB2 UDB for iSeries (Native - V5R1 and earlier)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_db2400_5)"
DB2 Universal JDBC Driver Provider (XA)
(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_2)

createJDBCProviderUsingTemplateAtScope script

Syntax

Example usage

The following example script contains required attributes only:

The following example script includes optional attributes in a string format:

AdminJDBC.createJDBCProviderUsingTemplateAtScope("/Cell:IBM-F4A849C57A0Cell01/ServerCluster:cluster1",  "DB2 Universal JDBC Driver Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_1)",  "My JDBC Name001", " com.ibm.db2.jcc.DB2ConnectionPoolDataSource",  "classpath= ${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar,  description='My description', isolatedClassLoader=false, nativepath=${DB2_JCC_DRIVER_NATIVEPATH},  providerType='DB2 Univesal JDBC Driver Provider', xa=true ") 

The following example script includes optional attributes in a list format:

AdminJDBC.createJDBCProviderUsingTemplateAtScope("/Cell:IBM-F4A849C57A0Cell01/ServerCluster:cluster1",  "DB2 Universal JDBC Driver Provider(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_DB2_UNI_1)",  "My JDBC Name001", " com.ibm.db2.jcc.DB2ConnectionPoolDataSource",  [['classpath', '${DB2_JCC_DRIVER_PATH}/db2jcc4.jar;
${UNIVERSAL_JDBC_DRIVER}/db2jcc_license_cu.jar;${DB2_JCC_DRIVER_PATH}/db2jcc_license_cisuz.jar'],  ['description', 'My description'], ['isolatedClassLoader', 'false'], ['nativepath', '${DB2_JCC_DRIVER_NATIVEPATH}'],  ['providerType', 'DB2 Univesal JDBC Driver Provider'], ['xa', 'true'], ['propertySet', [['resourceProperties',  [[['name', 'databaseName'], ['type', 'String'], ['value', 'myDbName']], [['name', 'driverType'], ['type', 'integer'],  ['value', 4]], [['name', 'serverName'], ['type', 'String'], ['value', 'localhost']], [['name', 'portNumber'],  ['type', 'Integer'],  ['value', 50000]]]]]]])


Related tasks

  • Use the script library to automate the application serving environment
  • Automating data access resource configuration

  • JDBC query scripts
  • JMS query scripts
  • JMS configuration scripts
  • J2C configuration scripts
  • J2C query scripts