Accessibility
Adobe
Sign in My orders My Adobe

Title

ColdFusion MX: Creating a JDBC data source for DB2Products affected

This TechNote describes how to configure a Macromedia ColdFusion MX JDBC data source to connect to DB2 using the DB2 Universal Database driver.

There are several JDBC Type IV drivers that are provided with ColdFusion MX Server Enterprise Edition and ColdFusion MX for J2EE. DB2 Universal Database is one of the available drivers that you can configure for data source connections.

Configuring a data source for DB2

Use the ColdFusion MX Administrator to add and configure a data source for DB2. When describing the connection settings for this type of data source, you will need to enter CollectionID, PackageName, and CreateDefaultPackage parameters in the Connection String field. After the data source connection is verified, you'll need to change or remove the CreateDefaultPackage parameters for all future connections. Otherwise, the connection will fail.

  1. Add a new data source in the ColdFusion Administrator:

    Use the Data Sources page to name the new data source and assign it the DB2 Universal Database in the driver field.
  2. Click Add to add the data source.

    The DB2 Universal Data Source Database page will display.
  3. Describe the following fields on the DB2 Universal Data SourceDatabase page:
    Field Description
    Database DB2 database instance name
    Server DB2 database server IP address or Hostname
    Port Port number (Defaults to 50000)
    Username Username for the DB2 instance
    Password Username's password for the DB2 instance

    Note: The username must have CREATE PACKAGE privileges for the database, or the database administrator must create a package. Consult the database administrator when configuring this type of data source.
  4. Click Show Advanced Settings and enter initial values for the data source's Connection String field (all one line):

    locationName=<databasename>;collectionID=DEFAULT; packageName=<packagename>;CreateDefaultPackage=TRUE;

    Where locationName = the name of the database to connect to,packageName = 7 characters or less, andCreateDefaultPackage = TRUE for the initial connection and FALSE for all subsequent connections.

    Note: A carriage return in the Connection String field will corrupt the neo-query.xml file; the SQLExecutive service will be unable to start and an error of "Element SQLExecutive is undefined in Request" is returned. This is logged as Macromedia issue 47552.
  5. Click Submit to update the data source and apply the settings.
  6. Verify the data source to test the connection and to create the default package.

    This is the initial connection for the data source.
  7. Change the Connection String field value for the data source so that CreateDefaultPackage=FALSE or delete the CreateDefaultPackage parameters.

    Note: This connection string attribute is only required for the initial connection. It must be removed or set to FALSE after the initial connection or the data source will fail.
  8. Submit the data source setting to apply the new connection string attribute value.
  9. Verify the data source to ensure that a connection can be established.
Connect string value examples

Initial connection (all on one line)
locationName=myDatabase;collectionID=default; packageName=JDBCPKG; CreateDefaultPackage=TRUE;
  • myDatabase is the database instance name for the connection.
  • JDBCPKG is the name of the package that the connection will create.
  • TRUE tells ColdFusion MX to create a default package. (Needed during the initial connection.)

All subsequent connections (all on one line)
locationName=myDatabase; collectionID=default; packageName=JDBCPKG

  • myDatabase is the database instance name for the connection.
  • JDBCPKG is the name of the package that the connection will create.

Doc ID
(tn_18337)

Last updated
2005-05-13

Products affected

Contacting Adobe Support

Still need help?
Find out about all your support options.
Contact support