Create JDBC generic 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 Oracle Type 4 JDBC drivers for DB2, Informix, MS SQL Server, and
Sybase. For more information about working with JDBC drivers, see Using 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 get Connection method. Data sources and their
connection pools provide connection management processes that help keep your
system running efficiently.
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,
then select Data Sources.
3.
On the Summary
of Data Sources page, click New
and select Generic Data Source.
4.
On the JDBC
Data Sources 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.
Click Next to continue.
5.
Select the database driver:
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.
6.
On the Transaction
Options page, follow these steps. Depending on the driver you selected on
the JDBC Data Source Properties page,
you may not need to specify any of these 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 Configure Transaction Options for Generic
Data Sources.
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 JDBC Data
Source Transaction Options.
Click Next to continue.
7.
On the Connection
Properties page, enter values for the following properties:
Service Name - This field is available only if you selected one of
the available Oracle RAC Service-Instance connections drivers. Specify the
service name of the database to which you want to connect. This must be the
same for each data source in a given multi data source. For more information on
configuring data sources to connect to Oracle RAC services, see Configuring
Connections to Services on Oracle RAC Nodes.
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. If you are creating an Oracle GridLink service-instance
connection, this must be the same for each data source in a given multi data
source.
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 account.
Click Next to continue.
8.
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 configuration 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.
9.
On the Select Targets page, select the servers
or clusters on which you want to deploy the data source.
10.
Click Finish
to save the JDBC data source configuration and deploy the data source to the
targets that you selected.
11.
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).
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.