Installing Upgrading Designing Configuring Deploying Monitoring Administering Troubleshooting Reference JBI Components
Close Print View
Designing: Connecting to a Database
 

Classic Java CAPS

Developing Java CAPS Projects

Using SOAP Message Handlers

Creating a Runtime Environment

Designing Business Processes in the Sun Business Process Manager

Working with TCP/IP HL7 Collaborations

Developing Sun Master Indexes (Repository)

Developing Sun Master Patient Indexes

Developing OTDs for Application Adapters

Developing OTDs for Communication Adapters

Developing OTDs for Database Adapters

Creating a New DB2 OTD

Select Wizard Type

Connecting to a Database

Selecting Database Objects

Selecting Table/Views/Aliases

Selecting Procedures

Add Prepared Statements

Specifying the OTD Name

To Specify the OTD Name

Reviewing Selections

Editing Existing OTDs

To Edit an Existing OTD

Creating a DB2 Connect OTD

Select Wizard Type

Connecting to Database

Selecting Database Objects

Selecting Table/Views/Aliases

Selecting Procedures

Adding Prepared Statements

Specifying the OTD Name

Review Selections

Editing Existing OTDs

To Edit an Existing OTD

Creating a New Informix OTD

Select Wizard Type

Connect To Database

Select Database Objects

Select Tables/Views/Aliases

Select Procedures

Add Prepared Statements

Specify the OTD Name

Review Selections

Steps to Edit an Existing Informix OTD

Steps to Edit the OTD from the Java CAPS IDE Include:

Creating a New JDBC OTD

Select Wizard Type

To Connect To Database

Select Database Objects

Select Tables/Views/Aliases

Select Procedures

Add Prepared Statement

Specify the OTD Name

Review Selections

Editing an Existing JDBC OTD

To Edit the OTD from the Java CAPS IDE

Creating an Oracle OTD

Select Wizard Type

Connect To Database

Select Database Objects

Select Tables/Views/Aliases

Select Procedures

Add Prepared Statement

Specify the OTD Name

Review Selections

Creating a New SQL Server OTD

Select Wizard Type

Connect to Database

Select Database Objects

Select Table/Views/Aliases

Select Procedures

Add Prepared Statements

Specify the OTD Name

Review Selections

Editing Existing OTDs

To Edit an Existing OTD

Creating a New Sybase OTD

Select Wizard Type

To Connect to Database

Select Database Objects

Select Tables/Views/Aliases

Select Procedures

Add Prepared Statement

Specify the OTD Name

Review Selections

Editing an Existing Sybase OTD

To Edit the OTD from the Java CAPS IDE

Creating a VSAM OTD

Select Wizard Type

Connect To Database

Select Database Objects

Select Tables/Views/Aliases

Add Prepared Statement

Specify the OTD Name

Review Selections

Using the OTD Importer in Netbeans

Developing OTDs for Web Server Adapters

Designing with Application Adapters

Designing with Communication Adapters

Designing with Web Server Adapters

SWIFT Integration Projects

Java EE Based Components

Designing with Sun JCA Adapters

About the TCP/IP JCA Adapter

Defining Constants and Variables

Using Database Operations

Developing Sun Master Indexes

Using the JMS JCA Wizard

Using the JAXB Wizard and Code-Seeder Pallete

Connecting to a Database

To Connect to a Database
  1. Select the Connection type using the drop-down list (see the following figure). The rest of the Connection Information fields displayed will depend on your selection.
    Connect to Database
  2. Specify the applicable connection information (depending on the Connection type) for your database including:
    • Host Name - The server where DB2 resides.

    • Port - The port number of DB2.

    • Location (AS/400 and z/OS specific) - The name of the DB2 subsystem. To find the location of the DB2 subsystem, use the Database Query Tool to issue the following query: select current server from sysibm.sysdummy1.

    • Database (Windows/Unix specific) - The name of the database instance.

    • Collection (AS/400 and z/OS specific) - The name that identifies a group of packages. For more information on Packages, refer to Packages.

    • User Name - The user name that the adapter uses to connect to the database.

    • Password - The password used to access the database.

    • An Optional Parameters field (only for AS/400 and z/OS) will display in the OTD Wizard if the DB2_ConnectionInfo.txt file is present in the netbeans\usrdir\modules\ext\ db2adapter directory. This field allows additional connection parameters for the DB2 OTD wizard. Please contact Sun Microsystems, Inc. for more information on Optional Parameters.

      Note - This parameter is not specific to an OTD. It’s only specific to the session where Java CAPS IDE runs. When you edit the OTD, the current value that shows up is the value that was entered previously in the Wizard. It may or may not be the same value you used for creating the original OTD.

      Parameter examples include:

      • The showSelectableTables=false parameter can be set to false (default is true) to see additional tables listed under a user, such as the behavior in a previous Adapter which uses an older version of the driver.

      • The AlternateID=user1 parameter allows you to set the object owner to be user1 otherwise the user in the User Name field will be used.

      • Multiple parameters can be used and must be separated by a semi-colon (;).

      • Click Next. The Select Database Objects window appears.

Packages

This Adapter uses a DataDirect driver (previously known as Merant) to execute SQL calls in DB2. The DataDirect driver requires packages to be created in the DB2 System. Packages do not contain specific SQL statements like static SQL packages but rather dynamic sections, used like cursors to help facilitate the driver’s executing of dynamic SQL queries and returning results.

Creating packages on the server, also known as binding packages, needs only be done once. The first user of the OTD Wizard must have bind permission to create the packages. Without bind authority the user receives an error message when the driver attempts to bind the packages and they will be unable to issue any SQL call. Packages are created automatically, under the Collection ID, when the user fills in the Wizard entries. If the Collection ID is left as blank, it will generate the packages under NULLID.

The driver creates SQL packages on the database including: DDJC330A, DDJC330B, DDJC330C, etc. When connecting, the driver queries a system table to determine whether the default packages exist on the system. If none exist, the driver creates them.

Note - SQL applications that execute dynamic SQL against DB2 need to have packages bound on the server. In the case of some IBM native tools this may not be obvious because the packages are already installed on the database by default.