DB2Binder utility

The DB2Binder utility binds the Db2 packages that are used at a Db2 for z/OS® data server by the IBM® Data Server Driver for JDBC and SQLJ, and grants EXECUTE authority on the packages to PUBLIC. Optionally, the DB2Binder utility can rebind Db2 packages that are not part of the IBM Data Server Driver for JDBC and SQLJ.

DB2Binder syntax

Read syntax diagramSkip visual syntax diagramjavacom.ibm.db2.jcc.DB2Binder-url"jdbc: db2://server :port /database:property= value;"-user user-ID-password password -size integer-collection collection-name-tracelevel ,trace-option-actionadd-actionreplace-actiondrop-actionrebind-reoptnone-reoptalways-reoptonce-reoptauto-blockingall-blockingunambig-blockingno-optprofileprofile-name-ownerauthorization-ID-sqlidauthorization-ID-generic-packagepackage-name-versionversion-id-keepdynamicno-keepdynamicyes-releasecommit-releasedeallocate-bindOptions"options-string"-verbose-help

DB2Binder option descriptions

-url
Specifies the data source at which the IBM Data Server Driver for JDBC and SQLJ packages are to be bound. The parts of the -url value are:
jdbc:db2:
Indicates that the connection is to a Db2 for z/OS data server.
server
The domain name or IP address of the operating system on which the data server resides.
port
The TCP/IP server port number that is assigned to the data server. The default is 446.
database
The location name for the data server, as defined in the SYSIBM.LOCATIONS catalog table.
property=value
A property and its value for the connection to the Db2 for z/OS data server. You can specify one or more property and value pairs. Each property and value pair, including the last one, must end with a semicolon (;). Do not include spaces or other white space characters anywhere within the list of property and value strings.

For example, if you are building the IBM Data Server Driver for JDBC and SQLJ packages on a Db2 12 for z/OS data server, and you want to specify values for the clientApplcompat and currentPackageSet properties, you can do it in the -url option value like this:

-url "jdbc:db2://sys1.svl.ibm.com:5021/STLEC1:clientApplcompat=V12R1M500;currentPackageSet=MYCOLL;"
-user
Specifies the user ID under which the packages are to be bound. This user must have BIND authority on the packages.
-action
Specifies the action to perform on the packages.
add
Indicates that a package can be created only if it does not already exist. Add is the default.
replace
Indicates that a package can be created even if a package with the same name already exists. The new package replaces the old package.
rebind
Indicates that the existing package should be rebound. This option does not apply to IBM Data Server Driver for JDBC and SQLJ packages.

If -action rebind and -bindOptions are specified, -generic must also be specified.

drop
Indicates that packages should be dropped:
  • For IBM Data Server Driver for JDBC and SQLJ packages, -action drop indicates that some or all IBM Data Server Driver for JDBC and SQLJ packages should be dropped. The number of packages depends on the -size parameter.
  • For user packages, -action drop indicates that the specified package should be dropped.

-action drop applies only if the target data server is Db2 for z/OS.

-size
Controls the number of Statement, PreparedStatement, or CallableStatement objects that can be open concurrently, or the number of IBM Data Server Driver for JDBC and SQLJ packages that are dropped.

The meaning of the -size parameter depends on the -action parameter:

  • If the value of -action is add or replace, the value of -size is an integer that is used to calculate the number of Db2 packages that the IBM Data Server Driver for JDBC and SQLJ binds. If the value of -size is integer, the total number of packages is:
    number-of-isolation-levels* 
    number-of-holdability-values* 
    integer+ 
    number-of-packages-for-static-SQL  
    = 4*2*integer+1
    The default -size value for -action add or -action replace is 3.

    In most cases, the default of 3 is adequate. If your applications throw SQLExceptions with -805 SQLCODEs, check that the applications close all unused resources. If they do, increase the -size value.

    If the value of -action is replace, and the value of -size results in fewer packages than already exist, no packages are dropped.

  • If the value of -action is drop, the value of -size is the number of packages that are dropped. If -size is not specified, all IBM Data Server Driver for JDBC and SQLJ packages are dropped.
  • If the value of -action is rebind, -size is ignored.
-collection
Specifies the collection ID for IBM Data Server Driver for JDBC and SQLJ or user packages. The default is NULLID. DB2Binder translates this value to uppercase.

You can create multiple instances of the IBM Data Server Driver for JDBC and SQLJ packages on a single data server by running com.ibm.db2.jcc.DB2Binder multiple times, and specifying a different value for -collection each time. At run time, you select a copy of the IBM Data Server Driver for JDBC and SQLJ by setting the currentPackageSet property to a value that matches a -collection value.

-tracelevel
Specifies what to trace while DB2Binder runs. For a list of the valid values, see DB2TraceManager class.
-reopt
Specifies whether data servers determine access paths at run time. This option is not sent to the data server if it is not specified. In that case, the data server determines the reoptimization behavior.

-reopt applies to connections to Db2 for z/OS Version 8 or later, or Db2 on Linux®, UNIX, and Windows systems Version 9.1 or later.

none
Specifies that access paths are not determined at run time.
always
Specifies that access paths are determined each time a statement is run.
once
Specifies that Db2 determines and caches the access path for a dynamic statement only once at run time. Db2 uses this access path until the prepared statement is invalidated, or until the statement is removed from the dynamic statement cache and needs to be prepared again.
auto
Specifies that access paths are automatically determined by the data server. auto is valid only for connections to Db2 for z/OS data servers.
-blocking
Specifies the type of row blocking for cursors.
ALL
For cursors that are specified with the FOR READ ONLY clause or are not specified as FOR UPDATE, blocking occurs.
UNAMBIG
For cursors that are specified with the FOR READ ONLY clause, blocking occurs.

Cursors that are not declared with the FOR READ ONLY or FOR UPDATE clause which are not ambiguous and are read-only will be blocked. Ambiguous cursors will not be blocked

NO
Blocking does not occur for any cursor.

For the definition of a read-only cursor and an ambiguous cursor, refer to "DECLARE CURSOR".

-optprofile
Specifies an optimization profile that is used for optimization of data change statements in the packages. This profile is an XML file that must exist on the target server. If -optprofile is not specified, and the CURRENT OPTIMIZATION PROFILE special register is set, the value of CURRENT OPTIMIZATION PROFILE is used. If -optprofile is not specified, and CURRENT OPTIMIZATION PROFILE is not set, no optimization profile is used.

-optprofile is valid only for connections to Db2 on Linux, UNIX, and Windows systems data servers.

-owner
Specifies the authorization ID of the owner of the packages. The default value is set by the data server.

-owner applies only to IBM Data Server Driver for JDBC and SQLJ packages.

-sqlid
Specifies a value to which the CURRENT SQLID special register is set before DB2Binder executes GRANT operations on the IBM Data Server Driver for JDBC and SQLJ packages. If the primary authorization ID does not have a sufficient level of authority to grant privileges on the packages, and the primary authorization ID has an associated secondary authorization ID that has those privileges, set -sqlid to the secondary authorization ID.

-sqlid is valid only for connections to Db2 for z/OS data servers.

-generic
Specifies that DB2Binder rebinds a user package instead of the IBM Data Server Driver for JDBC and SQLJ packages. If -generic is specified, -action rebind and -package must also be specified.
-package
Specifies the name of the package that is to be rebound. This option applies only to user packages. If -package is specified, -action rebind and -generic must also be specified.
-version
Specifies the version ID of the package that is to be rebound. If -version is specified, -action rebind, -package, and -generic must also be specified.
-keepdynamic
Specifies whether the data server keeps already prepared dynamic SQL statements in the dynamic statement cache after the point of commit or rollback so that those prepared statements can be reused. -keepdynamic applies only to connections to Db2 for z/OS.

Possible values are:

no
The data server does not keep already prepared dynamic SQL statements in the dynamic statement cache after the point of commit or rollback.
yes
The data server keeps already prepared dynamic SQL statements in the dynamic statement cache after the point of commit or rollback.

There is no default value for -keepdynamic. If you do not send a value to the data server, the setting at the data server determines whether dynamic statement caching is in effect. Dynamic statement caching occurs only if the EDM dynamic statement cache is enabled on the data server. The CACHEDYN subsystem parameter must be set to YES to enable the dynamic statement cache. Depending on the target server, the prepared statement cache might be preserved across transaction boundaries and not only after commit points.

-release
Specifies when to release data server resources that a program uses. -release applies only to connections to Db2 for z/OS. Possible values are:
deallocate
Specifies that resources are released under either of the following conditions:
  • When a program that is locally attached to Db2 for z/OS terminates.
  • When all connections are closed from a z/OS application server, such as WebSphere Application Server, that is using IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on Db2 for z/OS, and the client packages for the applications that are hosted by the application server are bound with RELEASE DEALLOCATE.

-release deallocate is the default for Db2 for z/OS Version 10 and later.

commit
Specifies that resources are released at commit points. -release commit is the default for Db2 for z/OS Version 9 and earlier.
-bindOptions
Specifies a string that is enclosed in quotation marks. The contents of that string are one or more parameter and value pairs that represent options for rebinding a user package. All items in the string are delimited with spaces:
"parm1 value1 parm2 value2parmn valuen"

-bindOptions does not apply to IBM Data Server Driver for JDBC and SQLJ packages that are bound on Db2 on Linux, UNIX, and Windows systems data servers.

You can specify the following -bindOptions values only when you rebind user packages:
bindObjectExistenceRequired
Specifies whether the data server issues an error and does not rebind the package, if all objects or needed privileges do not exist at rebind time. Possible values are:
true
This option corresponds to the SQLERROR(NOPACKAGE) bind option.
false
This option corresponds to the SQLERROR(CONTINUE) bind option.
degreeIOParallelism
Specifies whether to attempt to run static queries using parallel processing to maximize performance. Possible values are:
1
No parallel processing.

This option corresponds to the DEGREE(1) bind option.

-1
Allow parallel processing.

This option corresponds to the DEGREE(ANY) bind option.

packageAuthorizationRules
Determines the values that apply at run time for the following dynamic SQL attributes:
  • The authorization ID that is used to check authorization
  • The qualifier that is used for unqualified objects
  • The source for application programming options that the data server uses to parse and semantically verify dynamic SQL statements
  • Whether dynamic SQL statements can include GRANT, REVOKE, ALTER, CREATE, DROP, and RENAME statements
Possible values are:
0
Use run behavior. This is the default.

This option corresponds to the DYNAMICRULES(RUN) bind option.

1
Use bind behavior.

This option corresponds to the DYNAMICRULES(BIND) bind option.

2
When the package is run as or runs under a stored procedure or user-defined function package, the data server processes dynamic SQL statements using invoke behavior. Otherwise, the data server processes dynamic SQL statements using run behavior.

This option corresponds to the DYNAMICRULES(INVOKERUN) bind option.

3
When the package is run as or runs under a stored procedure or user-defined function package, the data server processes dynamic SQL statements using invoke behavior. Otherwise, the data server processes dynamic SQL statements using bind behavior.

This option corresponds to the DYNAMICRULES(INVOKEBIND) bind option.

4
When the package is run as or runs under a stored procedure or user-defined function package, the data server processes dynamic SQL statements using define behavior. Otherwise, the data server processes dynamic SQL statements using run behavior.

This option corresponds to the DYNAMICRULES(DEFINERUN) bind option.

5
When the package is run as or runs under a stored procedure or user-defined function package, the data server processes dynamic SQL statements using define behavior. Otherwise, the data server processes dynamic SQL statements using bind behavior.

This option corresponds to the DYNAMICRULES(DEFINEBIND) bind option.

packageOwnerIdentifier
Specifies the authorization ID of the owner of the packages.
isolationLevel
Specifies how far to isolate an application from the effects of other running applications. Possible values are:
1
Uncommitted read

This option corresponds to the ISOLATION(UR) bind option.

2
Cursor stability

This option corresponds to the ISOLATION(CS) bind option.

3
Read stability

This option corresponds to the ISOLATION(RS) bind option.

4
Repeatable read

This option corresponds to the ISOLATION(RR) bind option.

releasePackageResourcesAtCommit
Specifies when to release resources that a program uses at each commit point. Possible values are:
true
This option corresponds to the RELEASE(COMMIT) bind option.
false
This option corresponds to the RELEASE(DEALLOCATE) bind option.

For connections to Db2 for z/OS data servers, you can also specify any bind package options and their values that are listed in BIND and REBIND options for packages, plans, and services .

If -action rebind and -bindOptions are specified, -generic must also be specified.

-verbose
Specifies that the DB2Binder utility displays detailed information about the bind process.
-help
Specifies that the DB2Binder utility describes each of the options that it supports. If any other options are specified with -help, they are ignored.

DB2Binder return codes when the target operating system is not Windows

If the target data source for DB2Binder is not on the Windows operating system, DB2Binder returns one of the following return codes.

Table 1. DB2Binder return codes when the target operating system is not Windows
Return code Meaning
0 Successful execution.
1 An error occurred during DB2Binder execution.

DB2Binder return codes when the target operating system is Windows

If the target data source for DB2Binder is on the Windows operating system, DB2Binder returns one of the following return codes.

Table 2. DB2Binder return codes when the target operating system is Windows
Return code Meaning
0 Successful execution.
-100 No bind options were specified.
-101 -url value was not specified.
-102 -user value was not specified.
-103 -password value was not specified.
-200 No valid bind options were specified.
-114 The -package option was not specified, but the -generic option was specified.
-201 -url value is invalid.
-204 -action value is invalid.
-205 -blocking value is invalid.
-206 -collection value is invalid.
-207 -dbprotocol value is invalid.
-208 -keepdynamic value is invalid.
-210 -reopt value is invalid.
-211 -size value is invalid.
-212 -tracelevel value is invalid.
-307 -dbprotocol value is not supported by the target data server.
-308 -keepdynamic value is not supported by the target data server.
-310 -reopt value is not supported by the target data server.
-313 -optprofile value is not supported by the target data server.
-401 The Binder class was not found.
-402 Connection to the data server failed.
-403 DatabaseMetaData retrieval for the data server failed.
-501 No more packages are available in the cluster.
-502 An existing package is not valid.
-503 The bind process returned an error.
-999 An error occurred during processing of an undocumented bind option.