Setting the Db2 schema in a JVM server
You can set the current Db2® schema for a JVM server that accesses Db2 in a number of ways.
If the default Db2 schema is not the one that you want, you have two options:
- You can set the
db2.jcc.currentSchemato the name of the schema you want in the JVM profile. For example, the-Ddb2.jcc.currentSchema=CICSDB2Settingschema in the JVM profile ensures that all of the Db2 access through the JCC driver respects the chosen schema. For a Liberty JVM server, all dataSource definitions respect this value, unless they are otherwise overridden in the dataSource definition. - If you are using a Liberty JVM server, you can set the schema for an individual dataSource. For
example:
<dataSource id="ds1" jndiName="jdbc/ds1"> <jdbcDriver libraryRef="db2Lib"/> <properties.db2.jcc currentSchema="TESTER"/> </dataSource>
Tip: If you use the CICS default dataSource (created by using autoconfigure), then any values that are set in server.xml are overwritten each time the server is started. Create your own dataSource to prevent potential updates
to the CICS default dataSource overwriting your values.