WAS v8.5 > Script the application serving environment (wsadmin) > Scripting for data access resources > Configure data access with wsadmin scripting

Configure new J2C connection factories using wsadmin.sh

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

Before starting this task, wsadmin must be running. See the topic Starting the wsadmin scripting client article for more information. Configure a new J2C connection factory:

  1. Identify the parent ID and assign it to the newra variable.

    • Jacl:

        set newra [$AdminConfig getid /Cell:mycell/Node:mynode/J2CResourceAdapter:RAR1/]
    • 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 AdminTask:

      1. List the connection factory interfaces:

        • Jacl:

            $AdminTask listConnectionFactoryInterfaces $newra
        • Jython:

            AdminTask.listConnectionFactoryInterfaces(newra)

        Example output:

          javax.sql.DataSource

      2. Create a J2CConnectionFactory:

        • Jacl:

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

          AdminTask.createJ2CConnectionFactory(newra, '['-name', 'cf1', 
          '-jndiName', 'eis/cf1', '-connectionFactoryInterface', 
          'avax.sql.DataSource']')

    • Using the AdminConfig object:

      1. Identify the required attributes:

        • Jacl:

            $AdminConfig required J2CConnectionFactory
        • Jython:

            print AdminConfig.required('J2CConnectionFactory')

        Example output:

        Attribute Type
        connectionDefinition ConnectionDefinition@ 

      2. If wer resource adapter is JCA1.5 and we have multiple connection definitions defined, it is required specified the ConnectionDefinition attribute. If wer resource adapter is JCA1.5 and we have only one connection definition defined, it will be picked up automatically. If wer resource adapter is JCA1.0, we do not need to specify the ConnectionDefinition attribute. Perform the following command to list the connection definitions defined by the resource adapter:

        • Jacl:

            $AdminConfig list ConnectionDefinition $newra
        • Jython:

            print AdminConfig.list('ConnectionDefinition', $newra)

      3. Set up the required attributes:

        • Jacl:

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

          name = ['name', 'J2CCF1']
          jname = ['jndiName', 'eis/j2ccf1']
          j2ccfAttrs = [name,jname]

      4. If we are specifying the ConnectionDefinition attribute, also set up the following:

        • Jacl:

            set cdattr [list connectionDefinition $cd]
        • Jython:

            cdattr = ['connectionDefinition', $cd]

      5. Create a J2C connection factory:

        • Jacl:

            $AdminConfig create J2CConnectionFactory $newra $j2ccfAttrs
        • Jython:

            print AdminConfig.create('J2CConnectionFactory', newra, j2ccfAttrs)

        Example output:

          J2CCF1(cells/mycell/nodes/mynode|resources.xml#J2CConnectionFactory_1)

  3. Save the configuration changes. See the topic Saving configuration changes with wsadmin for more information.


Related


Use the wsadmin scripting AdminConfig object for scripted administration
Use the wsadmin scripting AdminTask object for scripted administration
Start the wsadmin scripting client using wsadmin.sh
Save configuration changes with wsadmin


Reference:

Commands for the AdminConfig object using wsadmin.sh
Commands for AdminTask using wsadmin.sh


+

Search Tips   |   Advanced Search