Configuring new J2C connection factories using wsadmin scripting

Use the wsadmin scripting tool to configure new Java™ 2 Connector connection factories.

Before you begin

Start the wsadmin tool.

About this task

Perform the following steps to configure a new J2C connection factory:

Procedure

  1. Identify the parent ID and assign it to the newra variable.
    • Using Jacl:

      set newra [$AdminConfig getid /Cell:mycell/Node:mynode/J2CResourceAdapter:RAR1/]
    • Using Jython:

      newra = AdminConfig.getid('/Cell:mycell/Node:mynode/J2CResourceAdapter:RAR1/')
      print newra
    Example output:
    RAR1(cells/mycell/nodes/mynode|resources.xml#J2CResourceAdapter_1)
  2. There are two ways to configure a new J2C connection factory. Perform one of the following:
    • Using the AdminTask object:
      1. List the connection factory interfaces:
        • Using Jacl:

          $AdminTask listConnectionFactoryInterfaces $newra
        • Using Jython:

          AdminTask.listConnectionFactoryInterfaces(newra)

        Example output:

        javax.sql.DataSource
      2. Create a J2CConnectionFactory:
        • Using Jacl:

          $AdminTask createJ2CConnectionFactory $newra { -name cf1 
          -jndiName eis/cf1 -connectionFactoryInterface avax.sql.DataSource
        • Using Jython:

          AdminTask.createJ2CConnectionFactory(newra, '['-name', 'cf1', 
          '-jndiName', 'eis/cf1', '-connectionFactoryInterface', 
          'avax.sql.DataSource']')
    • Using the AdminConfig object:
      1. Identify the required attributes:
        • Using Jacl:

          $AdminConfig required J2CConnectionFactory
        • Using Jython:

          print AdminConfig.required('J2CConnectionFactory')
        Example output:
        Attribute Type
        connectionDefinition ConnectionDefinition@ 
      2. If your resource adapter is JCA1.5 and you have multiple connection definitions defined, it is required that you specify the ConnectionDefinition attribute. If your resource adapter is JCA1.5 and you have only one connection definition defined, it will be picked up automatically. If your resource adapter is JCA1.0, you do not need to specify the ConnectionDefinition attribute. Perform the following command to list the connection definitions defined by the resource adapter:
        • Using Jacl:

          $AdminConfig list ConnectionDefinition $newra
        • Using Jython:

          print AdminConfig.list('ConnectionDefinition', $newra)
      3. Set up the required attributes:
        • Using Jacl:

          set name [list name J2CCF1]
          set jname [list jndiName eis/j2ccf1]
          set j2ccfAttrs [list $name]
        • Using Jython:

          name = ['name', 'J2CCF1']
          jname = ['jndiName', 'eis/j2ccf1']
          j2ccfAttrs = [name,jname]
      4. If you are specifying the ConnectionDefinition attribute, also set up the following:
        • Using Jacl:

          set cdattr [list connectionDefinition $cd]
        • Using Jython:

          cdattr = ['connectionDefinition', $cd]
      5. Create a J2C connection factory:
        • Using Jacl:

          $AdminConfig create J2CConnectionFactory $newra $j2ccfAttrs
        • Using Jython:

          print AdminConfig.create('J2CConnectionFactory', newra, j2ccfAttrs)
        Example output:
        J2CCF1(cells/mycell/nodes/mynode|resources.xml#J2CConnectionFactory_1)
  3. Save the configuration changes.