Skip navigation.
Downloads | Product Documentation | Support

Administration Console Online Help

# Create JDBC data sources

Before you begin

Make sure that the JDBC drivers that you want to use to create database connections are installed on all servers on which you want to deploy the data source. Some JDBC drivers are installed with WebLogic Server, including BEA WebLogic Type 4 JDBC drivers for DB2, Informix, MS SQL Server, Oracle, and Sybase. For more information about working with JDBC drivers, see Using Third-Party JDBC Drivers with WebLogic Server

In WebLogic Server, you configure database connectivity by adding JDBC data sources to your WebLogic domain. A data source is a J2EE standard method of configuring connectivity to a database. Each WebLogic data source contains a pool of database connections. Applications look up the data source on the JNDI tree or in the local application context and then reserve a database connection with the getConnection method. Data sources and their connection pools provide connection management processes that help keep your system running and performant.

To create a JDBC data source:

1. If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit (see Use the Change Center).
2. In the Domain Structure tree, expand Services > JDBC, then select Data Sources.
3. On the Summary of Data Sources page, click New.
4. On the JDBC Data Source Properties page, enter or select the following information:

   Name - Enter a name for this JDBC data source. This name is used in the configuration file (`config.xml`) and throughout the Administration Console whenever referring to this data source.

   JNDI Name - Enter the JNDI path to where this JDBC data source will be bound. Applications look up the data source on the JNDI tree by this name when reserving a connection.

   Database Type - Select the DBMS of the database that you want to connect to. If your DBMS is not listed, select Other.

   Database Driver - Select the JDBC driver you want to use to connect to the database. The list includes common JDBC drivers for the selected DBMS.

   Note: You must install JDBC drivers before you can use them to create database connections. Some JDBC drivers are installed with WebLogic Server, but many are not installed.

   Click Next to continue.

5. On the Transactions Options page, follow these steps:
   1. Select global transaction options:

      Supports Global Transactions - Select this check box (the default) to enable global transaction support in this data source. Clear this check box to disable (ignore) global transactions in this data source. In most cases, you should leave the option selected. See Transaction Options.

      If you selected Supports Global Transactions, select an option for transaction processing: (available options vary depending on whether you select an XA driver or a non-XA driver)

      - Two-Phase Commit - Select this option to enable standard XA processing.

        This option is only available when you select an XA JDBC driver to make database connections.

      - Logging Last Resource - Select this option to enable a non-XA JDBC connection to participate in global transactions using the Logging Last Resource (LLR) transaction optimization. Recommended in place of Emulate Two-Phase Commit.

        This option is only available when you select a non-XA JDBC driver to make database connections.

      - Emulate Two-Phase Commit - Enables a non-XA JDBC connection to emulate participation in distributed transactions using JTA. Select this option only if your application can tolerate heuristic conditions.

        This option is only available when you select a non-XA JDBC driver to make database connections.

      - One-Phase Commit - Select this option to enable the non-XA connection to participate in a global transaction as the only transaction participant.

        This option is only available when you select a non-XA JDBC driver to make database connections.

      For more information about transaction options, see Transaction Options

   2. Optionally, select Supports Local Transactions if the XA JDBC driver you selected supports local transactions as well as global transactions.

   Click Next to continue.

6. On the Connection Properties page, enter values for the following properties:

   Database Name - Enter the name of the database that you want to connect to. Exact database name requirements vary by JDBC driver and by DBMS.

   Host Name - Enter the DNS name or IP address of the server that hosts the database.

   Port - Enter the port on which the database server listens for connections requests.

   Database User Name - Enter the database user account name that you want to use for each connection in the data source.

   Password/Confirm Password - Enter the password for the database user acccount.

   Click Next to continue.

7. On the Test Database Connection page, review the connection parameters and click Test Configuration.

   WebLogic attempts to create a connection from the Administration Server to the database. Results from the connection test are displayed at the top of the page. If the test is unsuccessful, you should correct any configuation errors and retry the test.

   If the JDBC driver you selected is not installed on the Administration Server, you should click Next to skip this step.

   Click Next to continue.

8. On the Select Targets page, select the servers or clusters on which you want to deploy the data source.
9. Click Finish to save the JDBC data source configuration and deploy the data source to the targets that you selected.
10. To activate these changes, in the Change Center of the Administration Console, click Activate Changes.
    Not all changes take effect immediately—some require a restart (see Use the Change Center).