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.
Creating the connection cache
Click on the Connection Caches folder in EAServer Manager, and select File | New Connection Cache.
In the Connection Cache wizard, configure these settings and leave others at their default values:
Tab/ Setting |
Value |
---|---|
Name |
|
Description |
|
Database Type |
|
Server name |
|
User name |
|
Password |
|
Database Driver Type |
JDBC |
DLL or Class Name |
|
Verify the connection cache properties as follows:
Highlight the Glossary cache and choose File | Refresh.
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.
Associating the cache with the EJB components
Click on the Tutorial package and select the Glossary component.
Choose File | Component Properties.
In the Component Properties dialog box, display the Resource Refs tab.
Click Add to create a new reference in the list. Configure the values as follows:
Set the Name field to jdbc/glossary
.
For Type, choose java.sql.Datasource.
For Authentication, choose Container.
Click in the Resource Link field at the bottom of the dialog, and choose Glossary from the drop-down list.
Click OK to save the changes.
Repeat these steps for the Query component.
Copyright © 2005. Sybase Inc. All rights reserved. |