|
|
| |
Introduction to WebLogic JDBC
The following sections introduce the JDBC components and JDBC API:
JDBC is a Java API for executing SQL statements. The API consists of a set of classes and interfaces written in the Java programming language. JDBC provides a standard API for tool/database developers and makes it possible to write database applications using a pure Java API.
JDBC is a low-level interface, which means that it is used to invoke (or call) SQL commands directly. In addition, JDBC is a base upon which to build higher-level interfaces and tools, such as JMS and EJB.
JDBC drivers implement the interfaces and classes of the JDBC API. BEA provides a variety of options for database access using the JDBC API specification. These options include two-tier JDBC drivers, including WebLogic jDrivers for the Oracle, Microsoft SQL Server, and Informix database management systems (DBMS), and multitier drivers that work with WebLogic Server as an intermediary between a client application and the DBMS.
WebLogic Server uses the following types of JDBC drivers that work in conjunction with each other to provide database access:
The middle tier architecture allows you to manage database resources centrally in WebLogic Server. The vendor-neutral multitier JDBC drivers makes it easier to adapt purchased components to your DBMS environment and to write more portable code.
The following table summarizes the drivers that WebLogic Server uses.
Driver Tier |
Type and |
Database |
Documentation Sources |
---|---|---|---|
Two-tier |
Type 2 (native .dll): Type 4 (all Java) |
Between WebLogic Server and DBMS. |
Programming WebLogic JDBC (this document) Administration Guide, "Managing JDBC Connectivity" Installing and Using WebLogic jDriver for Oracle Installing and Using WebLogic jDriver for Informix Installing and Using WebLogic jDriver for Microsoft SQL Server |
Two-tier (XA) |
Type 2 (native .dll) |
Between WebLogic Server and DBMS in distributed transactions. |
Administration Guide, "Managing JDBC Connectivity" |
Multitier |
Type 3 |
Between client and WebLogic Server. The RMI driver replaces the deprecated t3 driver. The JTS driver is used in distributed transactions. The Pool and JTS drivers are server-side only. |
Programming WebLogic JDBC (this document) |
The following sections describe in detail the JDBC drivers introduced in Table 1-1 JDBC Drivers.
WebLogic Server JDBC Two-Tier Drivers
The following sections describe Type 2 and Type 4 BEA two-tier drivers used with WebLogic Server to connect to the vendor-specific DBMS.
BEA's Type 2 JDBC driver for Oracle, WebLogic jDriver for Oracle, is included with the WebLogic Server distribution. This driver requires an Oracle client installation. The WebLogic jDriver for Oracle XA driver extends the WebLogic jDriver for Oracle for distributed transactions. For additional information, see Installing and Using WebLogic jDriver for Oracle.
WebLogic jDriver for Microsoft SQL Server
BEA's WebLogic jDriver for Microsoft SQL Server, included in the WebLogic Server 6.1 distribution, is a pure-Java, Type 4 JDBC driver that provides connectivity to Microsoft SQL Server. For more information, see Installing and Using WebLogic jDriver for Microsoft SQL Server.
BEA's WebLogic jDriver for Informix, included in the WebLogic Server 6.1 distribution, is a pure-Java, Type 4 JDBC driver that provides connectivity to the Informix DBMS. For more information, see Installing and Using WebLogic jDriver for Informix.
WebLogic Server JDBC Multitier Drivers
The following sections describe the WebLogic multitier JDBC drivers that provide database access to the client. For more information on these drivers, see Using WebLogic Multitier Drivers in Programming WebLogic JDBC.
The WebLogic Pool driver enables utilization of connection pools from server-side applications such as HTTP servlets or EJBs.
The WebLogic RMI driver is a multitier, Type 3, Java Data Base Connectivity (JDBC) driver that runs in WebLogic Server and can be used with any two-tier JDBC driver to provide database access. Additionally, when configured in a cluster of WebLogic Servers, the WebLogic RMI driver can be used for clustered JDBC, allowing JDBC clients the benefits of load balancing and failover provided by WebLogic Clusters.
The WebLogic JTS driver is a multitier, Type 3, JDBC driver used in distributed transactions across multiple servers with one database instance. The JTS driver is more efficient than the WebLogic jDriver for Oracle XA driver when working with only one database instance because it avoids two-phase commit.
WebLogic Server works with third-party JDBC drivers that offer the following functionality:
In addition, WebLogic Server multitier drivers only support JDBC API and third-party drivers that provide functionality beyond non-standard JDBC calls.
An evaluation copy of this pure-Java DBMS from Cloudscape is included with your WebLogic Server distribution. A JDBC driver to access the Cloudscape DBMS is also included. This DBMS is used extensively in the code examples that are also included in the distribution. You may use this DBMS for testing and development if you do not have another DBMS available. There are limitations on the quantity of data that may be stored using this evaluation version.
For additional information, see Using the Cloudscape Database with WebLogic.
The two-tier Sybase jConnect Type 4 driver is bundled with your WebLogic Server distribution. This driver is provided for your use without charge. For information on using this driver with WebLogic Server, see Using Third-Party Drivers with WebLogic Server.
The two-tier Oracle Thin Type 4 driver provides connectivity from WebLogic Server to Oracle DBMS. For information on using this driver with WebLogic Server, see Using Third-Party Drivers with WebLogic Server.
Multitier drivers use WebLogic Server to access connection pools that provide ready-to-use pools of connections to your DBMS. Since these database connections are already established when the connection pool starts up, the overhead of establishing database connections is eliminated. You can utilize connection pools from server-side applications such as HTTP servlets or EJBs using the WebLogic Pool driver or from stand-alone Java client applications using the WebLogic RMI driver. This section provides an introduction to connection pools. For more detailed information, see Using Connection Pools.
Connection pools require a two-tier JDBC driver to make the connection from WebLogic Server to the DBMS. This two-tier driver can be one of the WebLogic jDrivers or a third-party JDBC driver, such as the Sybase jConnect driver, which is bundled with the WebLogic distribution. The following table summarizes the advantages to using connection pools.
Using Connection Pools with Server-side Applications
For database access from server-side applications, such as HTTP servlets, use the WebLogic Pool driver. For two-phase commit transactions, use the WebLogic Server JDBC/XA driver, WebLogic jDriver for Oracle/XA. For transactions distributed across multiple servers with one database instance, use the JTS driver. You can also access connection pools using the Java Naming and Directory Interface (JNDI) and a DataSource object.
Using Connection Pools with Client-side Applications
BEA offers the RMI driver for client-side, multitier JDBC. The RMI driver has the advantage of providing a standards-based approach using the Java 2 Enterprise Edition (J2EE) specifications. For new deployments, BEA recommends that you use the RMI driver, because the t3 client services are deprecated in this release.
The WebLogic RMI driver is a Type 3, multitier JDBC driver that uses RMI and a DataSource object to create database connections. This driver also provides for clustered JDBC, leveraging the load balancing and failover features of WebLogic Clusters. DataSource objects may be defined to enable transactional support or not.
JDBC MultiPools provide the option of choosing either the high availability or load balancing algorithm to enhance database connectivity. MultiPools are a "pool of pools" that allow a configurable algorithm for choosing among its list of pools, the pool that will be selected to provide the connection. For more information, see Using MultiPools.
Choosing the MultiPool Algorithm
You have the option of setting up a MultiPool in either of these ways:
WebLogic Server allows you to cluster JDBC objects, including data sources, connection pools, and multipools, to improve the availability of cluster-hosted applications. Each JDBC object you configure for your cluster must exist on each managed server in the cluster—when you configure the JDBC objects, target them to the cluster.
For more information about JDBC objects in a cluster, see "JDBC Connections" in Using WebLogic Server Clusters.
DataSource objects provide a way for JDBC clients to obtain a DBMS connection. A DataSource is an interface between the client program and the connection pool. Each data source requires a separate DataSource object, which may be implemented as a DataSource class that supports either connection pooling or distributed transactions. For more information, see Configuring and Using DataSources.
To create a JDBC application, use the java.sql API. The API allows you to create the class objects necessary to establish a connection with a data source, send queries and update statements to the data source, and process the results.
WebLogic JDBC Interface Definitions
The following table lists JDBC interfaces frequently used with WebLogic Server. For a complete description of all JDBC interfaces, see the java.sql or weblogic.jdbc Javadoc.
For information about these interfaces when using WebLogic jDriver for Oracle, see Installing and Using WebLogic jDriver for Oracle .
WebLogic Server uses JDK 1.3, which supports JDBC 2.0.
Limitations
Please be aware of the following limitations:
Supported platforms vary by vendor-specific DBMSs and drivers. For current information, see BEA WebLogic Server Platform Support.
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|