122 DB2 for z/OS and WebSphere: The Perfect Couple
Figure 5-3 Setting the currentSQLID property
5.6.2 CURRENT SCHEMA
The CURRENT SCHEMA special register is new in DB2 for z/OS Version 8. It can be set via
the SET CURRENT SCHEMA or the SET SCHEMA SQL statement. For dynamic SQL in
packages that use the DYNAMICRULES(RUN) option, it provides the same function as the
QUALIFIER bind option for static SQL. It is used to qualify unqualified SQL for dynamic SQL
(with DYNAMICRULES(RUN) behavior).
The value you specify can be any value, unlike the CURRENT SQLID where you must
specify a value that is your primary or a secondary authorization ID (unless you have some
special administrative authorities like SYSADM).
If the package is bound with the DYNAMICRULES BIND option, this statement does not
affect the qualifier that is used for unqualified database object references.
As far a Java applications are concerned, this option only affects JDBC applications and
uncustomized SQLJ applications (but those should be the exception). They both run dynamic
SQL.
The CURRENT SCHEMA special register can be initialized with a certain value when
connecting to a Data Source. It is as if the application had executed a SET SCHEMA
statement in the program as the very first statement.
A value for the CURRENT SCHEMA can be specified using the currentSchema property of a
data source. To do so, as always, we use the Admin Console. Data source properties can be
specified via Resources
JDBC Providers DB2 Universal JDBC Driver Provider
Data Sources
data-source-name Custom Properties. The configuration window is
also shown in Figure 5-4 on page 123.

Get DB2 for z/OS and WebSphere: The Perfect Couple now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.