Chapter 4 Database Access
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.
Creating
a new connection cache
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.
Viewing
or modifying a connection cache entry
The properties that you configure on the General tab are:
ServerName=serverName:Port=1521:DatabaseName=ORC:DriverType=thin
jConnect metadata support required If you have transactional components that use jConnect caches, make sure the jConnect DatabaseMetaData stored procedures are installed on the database server.
Configure these properties on the Cache tab:
Configure these properties on the Driver tab:
Type | Connection library name |
---|---|
Client Library 11.x |
You must use the version in the EAServer lib subdirectory. This version has been optimized for EAServer threading. |
ODBC |
|
JDBC | The Java class name for the driver class.
For example, if you are using a Sybase ASA or Adaptive Server Enterprise
database, set one of these values:
The Oracle connectivity driver requires oracle.jdbc.pool.OracleConnectionPoolDataSource |
OCI 7.x |
|
OCI 8.x | |
OCI 9.x |
Library location must be in library path On Solaris, Digital UNIX, and Linux, the location of the connection library must be in your LD_LIBRARY_PATH for ODBC, Client-Library, or OCI caches, and in CLASSPATH for JDBC caches.
On AIX, the file must be in your LIBPATH for ODBC, Client-Library, or OCI caches, and in CLASSPATH for JDBC caches.On HP-UX, the file must be in your SHLIB_PATH for ODBC, Client-Library, or OCI caches, and in CLASSPATH for JDBC caches.Type | Connection library name |
---|---|
Client Library 11.x | libjct.dll - you must use the version in the EAServer dll subdirectory. This version has been optimized for EAServer threading. |
ODBC | odbc32.dll |
JDBC | The Java class name for the driver class.
For example, if you are using a Sybase ASA or Adaptive Server Enterprise
database, set one of these values:
The Oracle connectivity driver requires oracle.jdbc.pool.OracleConnectionPoolDataSource |
OCI 7.x | ociw32.dll |
OCI 8.x | oci.dll |
OCI 9.x | oci.dll |
Library location must be in PATH or CLASSPATH The location of the connection library must be in your PATH environment variable for ODBC, Client-Library, or OCI caches, and in CLASSPATH for JDBC caches.
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.
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 specificationAny property whose name does not begin with
com.sybase.jaguar
is passed
to the JDBC driver as a connection property. For example:
PACKETSIZE=2048If 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.
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.
Make sure there is no extra white space between the
property name, the equal sign, and the property value, or after
the property value.
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.
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.
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=falseIf the
statementCache
setting
is not present, add the line above to the file.
If you have just modified connection cache properties, refresh the cache before you test it.
To refresh the cache:
Refreshing a cache may affect running components that are using the cache, specifically:
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:
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. |
![]() |