RAC JDBC Configuration

Source: Internet
Author: User
Tags failover

As we all know, ORACLE provides services in several ways THIN connect, OCI Connect, Datalink and other data connection methods.

1.THIN Connect

In a single-instance scenario, the JDBC Connect STRING:JDBC:ORACLE:THIN:10.11.1.243:1521/ORCL

where IP 10.11.1.243:1521 server IP address and lisener listening port.

ORCL is the data service name.

In a RAC environment, JDBC Connect String:

jdbc:oracle:thin:@ (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)

(HOST = 10.11.1.231) (PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)

(HOST = 10.11.1.232) (PORT = 1521)) (load_balance = yes) (FAILOVER = ON) (Connect_data = (SERVER = dedicated) (service_name = racdb.its) (failover_mode= (TYPE = SELECT) (METHOD = BASIC) (retires = 20) (DELAY = 15))))

Where host is a configuration of two points of Lisener. The failover keyword is configured for failover. The load_balance opens the settings for load balancing.

SERVICE_NAME is the database instance name for the RAC system.

The following is the code for the Java system:

Java Demo

The configuration of the 2.OCI connection is also the usual TNS configuration

Single-instance scenario: very simple, no more cumbersome.

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 10.11.1.243) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = ORCL)
)
)

RAC Condition:

RACDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = racdb1-vip.its) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = racdb)
(instance_name = RACDB1)
)
)

RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = racdb1-vip.its) (PORT = 1521))
(ADDRESS = (PROTOCOL = TCP) (HOST = racdb2-vip.its) (PORT = 1521))
(load_balance = yes)
(Connect_data =
(SERVER = dedicated)
(service_name = racdb)
)
)

LISTENERS_RACDB =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = racdb1-vip.its) (PORT = 1521))
(ADDRESS = (PROTOCOL = TCP) (HOST = racdb2-vip.its) (PORT = 1521))
)

Extproc_connection_data =
(DESCRIPTION =
(Address_list =

RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = racdb1-vip.its) (PORT = 1521))
(ADDRESS = (PROTOCOL = TCP) (HOST = racdb2-vip.its) (PORT = 1521))
(load_balance = yes)
(Connect_data =
(SERVER = dedicated)
(service_name = racdb)
)
)

LISTENERS_RACDB =
(Address_list =
(ADDRESS = (PROTOCOL = TCP) (HOST = racdb1-vip.its) (PORT = 1521)) (ADDRESS = (PROTOCOL = TCP) (HOST = racdb2-vip.its) (PORT = 1521))
)
Extproc_connection_data =
(DESCRIPTION = (Address_list =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1))
)
(Connect_data =
(SID = Plsextproc)
(PRESENTATION = RO)
)
)
RACDB2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = racdb2-vip.its) (PORT = 1521)) (Connect_data =
(SERVER = dedicated)
(service_name = racdb)
(instance_name = RACDB2)
)
)

Ext.: http://www.cnblogs.com/jerryxing/archive/2012/10/17/2728061.html

RAC JDBC Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.