JDBC query scripts

The scripting library provides many script procedures to manage Java™ Database Connectivity (JDBC) configurations in your environment. See the usage information for scripts that retrieve configuration IDs for your JDBC configuration. You can run each script individually or combine many procedures to create custom automation scripts for your 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. You can write your 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.
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.
Use the following script procedures to query your JDBC configuration:

listDataSources

This script displays a list of configuration IDs for the data sources in your configuration.

No input arguments are required for the script. However, you can specify a data source name to return a specific configuration id, as defined in the following table:
Table 1. listDataSources script . Run the script to list data sources.
Argument Description
dsName Optionally specifies the name of the data source of interest.

Syntax

AdminJDBC.listDataSources(dsName)

Example usage

AdminJDBC.listDataSources()
AdminJDBC.listDataSources("myDataSource")

listDataSourceTemplates

This script displays a list of configuration IDs for the data source templates in your environment.

No input arguments are required for the script. However, you can specify a template name to return a specific configuration id, as defined in the following table:
Table 2. listDataSourceTemplates script . Run the script to list data source templates.
Argument Description
templateName Optionally specifies the name of the template of interest.

Syntax

AdminJDBC.listDataSourceTemplates(templateName)

Example usage

AdminJDBC.listDataSourceTemplates()
AdminJDBC.listDataSourceTemplates("Derby JDBC Driver DataSource")

listJDBCProviders

This script displays a list of configuration IDs for the JDBC providers in your environment.

No input arguments are required for the script. However, you can specify a JDBC provider name to return a specific configuration id, as defined in the following table:
Table 3. listJDBCProviders script . Run the script to list JDBC providers.
Argument Description
jdbcName Optionally specifies the name of the JDBC provider of interest.

Syntax

AdminJDBC.listJDBCProviders(jdbcName)

Example usage

AdminJDBC.listJDBCProviders()
AdminJDBC.listJDBCProviders("myJDBCProvider")

listJDBCProviderTemplates

This script displays a list of configuration IDs for the JDBC provider templates in your environment.

No input arguments are required for the script. However, you can specify a template name to return a specific configuration id, as defined in the following table:
Table 4. listJDBCProviderTemplates script . Run the script to list JDBC provider templates.
Argument Description
templateName Optionally specifies the name of the template of interest.

Syntax

AdminJDBC.listJDBCProviderTemplates(templateName)

Example usage

AdminJDBC.listJDBCProviderTemplates()
AdminJDBC.listJDBCProviderTemplates("Derby JDBC Provider")