Using Generic Data Sources

Generic data sources provide database access and database connection management. Generic data sources and their connection pools provide connection management processes that help keep your system running efficiently.

What is Generic Data Source

Generic data sources provide database access and database connection management.

Each data source contains a pool of database connections that are created when the data source is created and at server startup. Applications reserve a database connection from the data source by looking up the data source on the JNDI tree or in the local application context and then calling getConnection(). When finished with the connection, the application should call connection.close() as early as possible, which returns the database connection to the pool for other applications to use.

Configuring Generic Data Source

This topic describes the steps required to create and configure Generic data sources.

Configure JDBC Data Source Properties

Data Source Names: You can use JDBCA data source name to identify the data source within the WebLogic domain. For system resource data sources, names must be unique among all other JDBC system resources. To avoid naming conflicts, data source names should also be unique among other configuration object names, such as servers, applications, clusters, and JMS queues, topics, and servers. For JDBC application modules packaged in an application, data source names must be unique among JDBC data sources with a similar scope.

Data Source Scope: You can select the scope for the data source and set the scope to Global (at the domain level), or to any existing Resource Group or Resource Group Template.

JNDI Names: You can configure a data source so that it binds to the JNDI tree with a single or multiple names. See Using WebLogic JNDI in a Clustered Environment in Developing JNDI Applications for Oracle WebLogic Server.

Database Type: You can select the Database Management System (DBMS) of the database you want to connect. See Supported Configurations in What's New in Oracle WebLogic Server.

JDBC Driver: You must select a JDBC database driver that is preferred to create a database connection. You should verify, however, that the URL is as you want it before asking the console to test it. The driver you select must be in the classpath on all servers on which you intend to deploy the data source.

Some but not all JDBC drivers listed in the WebLogic Server Administration Console are shipped (and/or are already in the classpath) with WebLogic Server. See Types of JDBC Drivers.

All of these drivers are referenced by the weblogic.jar manifest file and do not need to be explicitly defined in a server's classpath.

When deciding which JDBC driver to use to connect to a database, you should try drivers from various vendors in your environment. In general, JDBC driver performance is dependent on many factors, especially the SQL code used in applications and the JDBC driver implementation. See Supported Configurations in What's New in Oracle WebLogic Server.

Configure Transaction Options

When you configure a JDBC data source using the WebLogic Server Administration Console, WebLogic Server automatically selects specific transaction options based on the type of JDBC driver. XA, non-XA, and Global transaction options are supported by WebLogic JDBC data sources. See JDBC Data Source Transaction Options.

Configure Testing Options

You can set database connection testing options in a data source to make sure that the database connections remain healthy, which helps keep your applications running properly.

Connection Properties are used to configure the connection between the data source and the DBMS. Typical attributes are the database name, host name, port number, user name, and password.

Test Database Connection allows you to test a database connection before the data source configuration is finalized using a table name or SQL statement. If necessary, you can test additional configuration information using the Properties and System Properties attributes. See Configure testing options for a JDBC data source in Oracle FMW Administration Console Online Help.

Configure Oracle Parameters

WebLogic Server provides several attributes that provide improved data source performance when using Oracle drivers. See Advanced Configurations for Oracle Drivers and Databases.

Target JDBC Data Sources

You can select one or more targets to which to deploy your new JDBC data source. If you don't select a target, the data source will be created but not deployed. You will need to deploy the data source at a later time before getting connections. See Target JDBC data sources in Oracle WebLogic Server Administration Console Online Help and Using JDBC Drivers with WebLogic Server.