Start the glossary database server  Create the client application

Chapter 4: Creating Enterprise JavaBeans Components and Clients

Create the connection cache and associate it with the components

A connection cache maintains a pool of connections to a database server, increasing performance by allowing connection sharing and reuse. EJB connections obtain database connections using JNDI. In EAServer, we must associate a connection cache with the JNDI name alias that the component uses to look up connections.

StepsCreating the connection cache

  1. Click on the Connection Caches folder in EAServer Manager, and select File | New Connection Cache.

  2. Enter Glossary as the name.

  3. In the Connection Cache Properties dialog, configure these settings:

    Tab/ Setting

    Value

    General/ Description

    Glossary database

    General/ Server name

    NetworkProtocol=Tds:Server=localhost:Port=2640

    NotePort numbers must match Make sure the port number used in the connection cache properties matches the port number you specify in the start script or batch file for the database server.

    General/ User name

    dba

    General/ Password

    sql

    Driver/ DLL or Class Name

    com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource

    Driver/ Type

    JDBC

    Caching/ Enable Cache-by-Name Access

    (Selected)

  4. Leave other settings as-is and click OK.

  5. Verify the connection cache properties as follows:

    1. Highlight the Glossary cache and select File | Properties.

    2. Click Refresh, then click Ping. If the Ping operation fails, confirm that you have applied the settings correctly and that the database is running.

StepsAssociating the cache with the EJB components

  1. Click on the Tutorial package and select the Glossary component.

  2. Choose File | Component Properties.

  3. In the Component Properties dialog box, display the Resource Refs tab.

  4. Click Add to create a new reference in the list. Configure the values as follows:

    1. Set the Name field to jdbc/glossary.

    2. For Type, choose java.sql.Datasource.

    3. For Authentication, choose Container.

  5. Click in the Resource Link field at the bottom of the dialog, and choose Glossary from the drop-down list.

  6. Click OK to save the changes.

  7. Repeat these steps for the Query component.





Copyright © 2003. Sybase Inc. All rights reserved. Create the client application

View this book as PDF