Configuring connectors

A connector is a specialized connection factory that provides connections for EJBs, Java servlets, JSPs, and CORBA-Java components.

Each connector has one managed connection factory with its own property file. The Java Connection Manager (JCM) classes create the connection factories and manage a pool of connections for a connector.

Transaction modes

EAServer connectors support these transaction modes:

Transaction attribute

Description

NO_TRANSACTION

The connector is nontransactional; it does not support local transactions or XA resources.

LOCAL_TRANSACTION

The connector implements only the LocalTransaction interface, therefore, EAServer must manage all transactions.

XA_TRANSACTION

The connector supports both local transactions and XA transactions.

For information on importing and exporting connectors, see “Deploying connectors”.

StepsConfiguring a connector

  1. Expand the Connectors folder, then highlight the connector you want to configure.

  2. Choose File | Properties.

  3. The Connector Properties dialog box has four tabs.

    1. On the General tab:

      1. Enter a description for the connector.

      2. Set the Configured Queue Size; the default size is 10. This defines the maximum number of connections that can be pooled. When a component requests a connection, EAServer attempts to get it from the connection pool. If none exists, it opens a new connection.

      3. Set the Idle Connection Timeout, in seconds. Connections are dropped from the pool when they have been idle for this amount of time. The default is 0, which means the connection never times out.

    2. On the Config Properties tab, add environment entries:

      1. Click Add. This adds a new row to the Environment Entries Referenced in Code list.

      2. In the Entry column, enter ConnectionURL.

      3. In the Type column, choose String.

      4. In the Value column, enter the JNDI name for the resource; for example, jdbc:sybase:Tds:myhost:2638.

      5. In the Description field, enter a brief description of the connector.

    3. On the Java Classes tab:

      1. Click Add. This adds a new row to the Java Classes list.

      2. Enter the name of the JAR file that implements the connector.

      You can repeat these steps to add other JAR files required to run the connector. These JAR files are loaded by the EAServer custom class loader and reloaded when you refresh the connector. Classes or JAR files not listed here are loaded by the Java system class loader, which means you must restart the server to use new versions of the classes.

    4. The Advanced tab lists all the properties associated with the connector.

NoteYou cannot test the connections obtained from a connector using ping.

StepsAdding a managed connection factory

For each connector, add one managed connection factory.

  1. Expand the Connectors folder, then highlight the connector to which you want to add a managed connection factory.

  2. Choose File | New Managed Connection Factory.

  3. Choose File | New Managed Connection Factory Wizard. Follow the wizard pages to configure the new connector. If you require more information on any setting, click Help in the wizard.

StepsConfiguring connector properties

  1. Highlight the icon for the managed connector factory that you want to configure. Choose File | Properties.

  2. The Connection Factory Properties dialog box, which has four tabs, displays:

    1. On the General tab:

      1. Enter a description for the managed connection factory.

      2. Set the Configured Queue Size.

      3. Set the Idle Connection Timeout, in seconds.

    2. On the Config Properties tab, add environment entries.

      1. Click Add. This adds a new row to the Environment Entries Referenced in Code list.

      2. In the Entry column, enter “ConnectionURL”.

      3. In the Type column, choose String.

      4. In the Value column, enter the JNDI name for the resource; for example, jdbc:sybase:Tds:myhost:2638.

      5. In the Description field, enter a brief description of the managed connection factory.

    3. On the Security Properties tab, enter a user name and password that are valid to access the resource.

    4. The Advanced tab lists all the properties associated with the managed connection factory.

Within an application, you can use JNDI to look up a connector’s managed connection factory instance and get a connection to an enterprise information system, as this code sample illustrates:

// Get the initial JNDI context
Context initContext = new InitialContext();

// Look up a connection factory instance
javax.resource.cci.ConnectionFactory cf =    (javax.resource.cci.ConnectionFactory)
   initCtxt.lookup(“java:comp/env/eis/MyEIS);

javax.resource.ci.Connection conn = cf.getConnection();

StepsSynchronizing a connector

You can synchronize a connector within a cluster of servers by using EAServer Manager to copy standalone connectors and their property files to other servers.

  1. Expand the Connectors folder, then highlight the connector you want to synchronize.

  2. Choose File | Synchronize. This displays the Synchronize Connector dialog box.

  3. See Table 6-1 for a description of the synchronization properties.

  4. Click Start Sync. The Synchronization message box displays the status of the process.

StepsRefreshing a connector

  1. Expand the Connectors folder, then highlight the connector you want to refresh.

  2. Choose File | Refresh.

StepsRefreshing a connector view

  1. Expand the Connectors folder, then highlight the connector whose view you want to refresh.

  2. Choose File | Refresh View.

StepsDeleting a connector

  1. Expand the Connectors folder, then highlight the connector you want to delete.

  2. Choose File | Delete Connector.

For more information on managing connections, see Chapter 26, “Using Connection Management,” in the EAServer Programmer’s Guide.