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. In the Connection Cache wizard, configure these settings and leave others at their default values:

    Tab/ Setting

    Value

    Name

    Glossary

    Description

    Glossary database

    Database Type

    Sybase_ASA

    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.

    User name

    dba

    Password

    sql

    Database Driver Type

    JDBC

    DLL or Class Name

    com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource

  3. Verify the connection cache properties as follows:

    1. Highlight the Glossary cache and choose File | Refresh.

    2. Highlight the Glossary cache and choose File | 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 © 2005. Sybase Inc. All rights reserved. Create the client application

View this book as PDF