Using EJB providers

An EJB provider allows you to define a set of client property settings that can be referenced by name when running clients. For example, you might wish all clients to run with data compression enabled. You can define EJB providers with the Management Console or using an XML configuration file. To set up an EJB provider for use by clients, you must:

To run clients with the EJB provider settings, specify the name in the value of the java.naming.provider. url property using the format described in “URLs to specify an EJB Provider name”.

Properties set in the EJB provider definition take precedence over those set in the EJB client code or in Java system properties.

EJB providers cannot be used in applets, because this feature requires access to configuration files in the EAServer installation directory.

StepsCreating EJB providers in the Management Console

  1. Start the Management Console and connect to EAServer as described in Chapter 1, “Getting Started,”in the System Administration Guide.

  2. Expand the Naming Providers folder and EJB Providers folder beneath it.

  3. Right-click the EJB Providers folder and choose Add. Run the Add wizard to create the EJB provider with a unique name.

  4. Configure the properties listed in Table 3-2.

StepsConfiguring EJB providers in the Management Console

  1. Start the Management Console and connect to EAServer as described in Chapter 1, “Getting Started,”in the System Administration Guide.

  2. Expand the Naming Providers folder and EJB Providers folder beneath it.

  3. Highlight the name of your EJB provider to display its properties in the right frame. Configure the properties listed in Table 3-2. Each property configures the indicated initial context property. See Table 3-1 for descriptions of the initial context properties.

    Table 3-2: EJB Provider settings

    Display name

    Initial context property

    JNDI Initial Context Factory

    java.naming.factory.initial

    JNDI Provider URL

    java.naming.provider.url

    JNDI Security Principal (User name)

    java.naming.security.principal

    JNDI Security Credentials (Password)

    java.naming.security.credentials

    Idle Connection Timeout

    com.sybase.ejb. idleConnectionTimeout

    Lookup Cache Timeout

    com.sybase.ejb. lookupCacheTimeout

    Socket Timeout

    com.sybase.ejb. socketTimeout

    Enable Automatic Failover

    com.sybase.ejb. disableAutomaticFailover

    Enable Data Compression

    com.sybase.ejb. enableAutomaticFailover

StepsCreating and configuring EJB providers in an Ant configuration file

You can create and configure an EJB provider in Ant configuration files, such as that for the EJB package that contains the components that your application invokes.

  1. Edit the XML configuration file. In a configuration target, add an invocation of the setProperties task with the following format:

    <setProperties ejbProvider="provider">
      <prop1=”value1”/>
      <prop2=”value2”/>
      ...
    </setProperties>
    

    Where:

  2. Configure or recompile the entity that uses the configuration file. EAServer creates the EJB provider if it does not exist then sets the properties to match the values given in the configuration file.