Chapter 4 Database Access


Configuring connection caches

A connection cache maintains a pool of available connections that EAServer components use to interact with third-tier data servers. You must configure connection caches for the specific user and database combinations used by your components. A connection cache entry improves performance by eliminating the overhead associated with setting up a connection when one is required. Create as many connection caches as you need.

See Chapter 24, "Using Connection Management," in the EAServer Programmer's Guide for additional information.

You must refresh a cache before any changes to the cache properties take effect, and you should test the connection with ping before trying to access it from components.

You cannot define two distinct caches that use identical values for server, user, password, and connectivity library. If two caches are defined with matching values for these settings, and your application requests one, EAServer returns the first match that is found.

Steps Creating a new connection cache

  1. Highlight the Connection Caches folder.
  2. Select either File | New Connection Cache or File | New XA Resource.
  3. Configure the connection cache properties.

Configured connection cache entries appear on the right side of the window of Jaguar Manager when you highlight the Connection Cache folder on the left side of the window.


Steps Viewing or modifying a connection cache entry

  1. Expand the Connection Caches folder.
  2. Highlight the connection cache you want to modify.
  3. From the File menu, select one of:

General properties

The properties that you configure on the General tab are:

Cache properties

Configure these properties on the Cache tab:

Driver properties

Configure these properties on the Driver tab:

All Properties tab

To set the cache properties described in this section, use the All Properties tab. For a detailed list of the properties you can define for a connection cache, see Connection cache properties. Additional driver-specific properties may be required depending on the type of cache and driver class or library.

JDBC driver properties

For JDBC connection caches, properties that do not begin with com.sybase.jaguar.connection are passed through as driver properties for the connection.

Different JDBC drivers recognize different sets of properties. For a JDBC connection cache, these additional connection properties allow you to specify settings beyond those shown in the Connection Cache Properties dialog.

Cache properties are defined in this form:

propname=value specification
Any property whose name does not begin with com.sybase.jaguar is passed to the JDBC driver as a connection property. For example:
PACKETSIZE=2048
If a property setting conflicts with a setting in the Connection Cache Properties dialog, the dialog setting takes precedence.

See your driver documentation for more information.

Client-Library connection settings

You can set the following properties for Client-Library connections. See the Client-Library documentation for the ct_con_props routine for more information:

This example sets all of these properties:

CS_HOSTNAME=myhostname
CS_TDS_VERSION=CS_TDS_46
CS_PACKETSIZE=512
CS_APPNAME=myapp

Any property name not recognized by EAServer is ignored.

The CS_TDS_VERSION property takes one of these values: CS_TDS_50, CS_TDS_495, CS_TDS_46, CS_TDS_42, or CS_TDS_40.

The CS_PACKETSIZE property takes a numeric value within the range of legal packet sizes for the server. If the server does not support the packet size, the cache cannot connect to the server.

Note   Make sure there is no extra white space between the property name, the equal sign, and the property value, or after the property value.

Database type setting

In connection caches used to support automatic persistence or stateful failover, you must configure the Database Type connection cache property. This property defines database-specific information required by the storage component, for example, the commands to verify a table exists and create new tables. Several types are predefined, as described in Table 4-3.

Table 4-3: Database type identifiers
Database identifier To indicate
Oracle8i Oracle version 8
Oracle9i Oracle version 9
SQL_Server Microsoft SQL Server
Sybase_ASA Sybase Adaptive Server Anywhere
Sybase_ASE Sybase Adaptive Server Enterprise
Unknown Any other database.

You can create your own database type definitions by copying one of the existing files in the EAServer Repository/DatabaseType directory, then editing the property settings. Any changes made to the predefined database type files may be overwritten by subsequent EAServer installs.

Note  

Use of prepared statements To support EJB CMP or automatic persistence for entity components, EAServer uses JDBC prepared statements to execute database queries. On some databases, the use of prepared statements may exhaust database resources such as cursors in Oracle. If you encounter this problem, edit the database type properties file in the EAServer Repository/DatabaseType subdirectory. Look for a line that contains "statementCache" and edit the setting to look like this:

com.sybase.jaguar.databasetype.statementCache=false 

If the statementCache setting is not present, add the line above to the file.

Connection cache refresh

If you have just modified connection cache properties, refresh the cache before you test it.

To refresh the cache:

  1. Highlight the Connection Caches folder.
  2. Highlight the cache's icon and choose File | Connection Cache Properties.
  3. In the Connection Cache Properties dialog, click Refresh.

Refreshing a cache may affect running components that are using the cache, specifically:

Connection cache ping

This feature allows you to test the cache configuration to verify that connections can be made using the supplied parameters. If you have just changed any settings, refresh the cache before testing it.

To test the cache with ping:

  1. Highlight the Connection Caches folder.
  2. Highlight the cache's icon and choose File | Connection Cache Properties.
  3. In the Connection Cache Properties dialog, enter the password. (Though the password is recorded in the repository, the window does not display it.)
  4. Click Ping.
  5. Jaguar Manager reports whether the connection attempt succeeded.

If ping fails, check the message text for a description of the problem. The server log file may contain additional information about the cause of the error.

If you change the cache properties to correct the problem, you must refresh the cache before testing again.

 


Copyright © 2002 Sybase, Inc. All rights reserved.