Learn how the Db2 driver manages package creation automatically and how to explicitly create or copy Db2 packages when needed.
Automatic Db2 Package Creation
The Db2 driver automatically creates all required Db2 packages the first time it connects to a database. By default, these packages contain 200 dynamic sections and are created in the NULLID collection (or library).
DB2 packages created. When to Explicitly Create Db2 Packages
In most cases, you do not need to manually create Db2 packages, as the driver handles this automatically. However, if you need to explicitly create packages (for example, for advanced configuration or deployment scenarios), you can do so using one of the following methods:
- Running the appropriate Db2 package creation list file for your operating system on the database server.
- Copying existing Db2 packages to your environment.
BINDADD privileges on the database. Consult your database
administrator to ensure you have the necessary permissions. Explicitly Creating Db2 Packages
To explicitly create Db2 packages, bind the appropriate package creation list files for your operating system on your database server. Binding these files will replace any existing packages with new ones containing 200 dynamic sections in the NULLID collection.
- Install the list (
.lst) and bind (.bnd) files to a directory on the database server. - Open the Db2 command-line utility from the directory where you placed the list and bind files.
- Connect to the target database using the following command:
Replace database_name with the name of your database, authorization_name with your user name, and password with your password.connect to database_name user authorization_name using password - Bind the list file using the following command:
Replace list_file with the name of the list file you want to bind.bind @ list_file grant public
Copying Db2 Packages
If you need to copy existing Db2 packages (for example, to a mainframe environment), follow these steps:
- Install
CNTLFILE.XMITandDBRMFILE.XMITfiles. - Log on to the mainframe system where you will bind the packages. Pre-allocate
two sequential datasets using the following parameters:
DSORG=PSRECFM=FBLRECL=80BLKSIZE=3120
Example dataset names:
- userid.CNTLFILE.XMIT
- userid.DBRMFILE.XMIT
- FTP to the mainframe system using the same user ID and password as above.
- Set the transfer mode to binary by typing
BIN. - Upload the
cntlfile.xmitanddbrmfile.xmitfiles using thePUTcommand. Ensure these files replace the datasets you created in step 2. - From ISPF option 6 or TSO Ready
mode, issue the following commands to create the partitioned datasets containing
the JCL and distribution packages:
RECEIVE INDS('userid.CNTLFILE.XMIT') RECEIVE INDS('userid.DBRMFILE.XMIT') - By default, the datasets
userid.DDJDBC.CNTLanduserid.DDJDBC.DBRMLIBare created. Edit the jobuserid.DDJDBC.CNTL(BIND)and follow the instructions in that job to bind the packages for the Connect for JDBC Db2 driver and grant execute privileges to users as needed.
Additional Notes
- Always ensure you have the necessary privileges before attempting to create or bind Db2 packages.
- Consult your database administrator if you are unsure about any of the steps or required permissions.
- For more information, refer to the official Db2 documentation for your platform.