Chapter 4 Database Access


Connecting to databases

This section contains details on connecting EAServer components to specific third-tier databases, including:

Sybase Adaptive Server Anywhere

On most platforms, EAServer includes a copy of Sybase Adaptive Server Anywhere (formerly called Sybase SQL Anywhere). The EAServer sample components use a preconfigured Adaptive Server Anywhere database and Adaptive Server Anywhere ODBC data source. The sample C++ components connect using an ODBC connection cache. The sample Java components connect using the Sybase jConnect™ for JDBC™ driver. View the predefined sample connection caches in Jaguar Manager for examples of configuring a cache to connect to Adaptive Server Anywhere.

EAServer includes the jConnect runtime classes, and you can connect to Adaptive Server Anywhere with the same settings that you would use for Adaptive Server Enterprise. See "Sybase Adaptive Server Enterprise and gateways".

Note  

Do not use the JDBC-ODBC bridge driver Some EAServer samples use the JDBC-ODBC bridge driver, included in JDK versions later than 1.1. This driver is suitable for demonstration use only. Do not use the JDBC-ODBC driver in production application deployment, or to support persistence for the EAServer message service.

Sybase Adaptive Server Enterprise and gateways

You can connect components to Sybase Adaptive Server Enterprise, OmniConnect™, or DirectConnect™ using ODBC, JDBC, or Sybase Open Client Client-Library.

To use ODBC, you must install the Sybase Adaptive Server Enterprise ODBC driver. EAServer includes ODBC drivers for some platforms. For details, see the EAServer Installation Guide for your platform.

To use JDBC, use Jaguar Manager to define a JDBC connection cache that connects using the JDK 1.2 (or later) implementation of the jConnect driver. EAServer includes jConnect 5.5 or later runtime classes in java/lib/jconn2.jar, which is in the server's CLASSPATH by default. See the jConnect documentation for details on using jConnect, including:

The jConnect documentation is available on the EAServer 4.0 Technical Library CD and is also on the Sybase Web page .

Note  

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.

Oracle databases

You can connect to Oracle databases using JDBC, ODBC, or the Oracle Call Interface (OCI). EAServer does not include JDBC or ODBC drivers for Oracle or the OCI libraries. EAServer provides dedicated support for Oracle's proprietary C interface, OCI versions 7, 8, and 9. OCI connections that are cached by EAServer are used like any other OCI connection, except that EAServer opens the connection for you.

You can create Oracle connection caches that use ODBC or JDBC as for any other ODBC or JDBC cache, as described in "Other databases". For information on how to use an OCI cache in a C or C++ component, see "Using OCI 7.x connection caches" in Chapter 24, "Using Connection Management," in the EAServer Programmer's Guide.

Other databases

EAServer components can connect to any database for which an ODBC or JDBC driver is available. Contact your database vendor for information on JDBC or ODBC driver availability.

Note  

Do not use the JDBC-ODBC bridge driver This driver is suitable for demonstration use only. Do not use the JDBC-ODBC driver in production application deployment, or to support persistence for the EAServer message service.

To achieve ODBC connectivity, install the appropriate driver, configure a data source that uses the ODBC driver to connect to the target database, then define an EAServer connection cache that uses that data source.

To achieve JDBC connectivity, install the appropriate JDBC driver, then define an EAServer connection cache that uses that driver to connect to the target server. When you run the server, you must include the path to the driver's class file in your system's CLASSPATH setting. Many drivers require further configuration. For example, you may have to install stored procedures on each server that you intend to connect to. See your JDBC driver documentation for further configuration instructions.

Note   Most JDBC drivers provide standalone test utility applications (or at least sample applications) that you can use to verify that the driver and data sources are correctly configured. Verify connectivity with a standalone application before configuring EAServer to use a new driver and data source combination.

See "Configuring connection caches" for information on defining connection caches.

 


Copyright © 2002 Sybase, Inc. All rights reserved.